Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / public / platform / WebThreadedDataReceiver.h
blob07e7cbe07beba2e7cd19916249ac054582808351
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef WebThreadedDataReceiver_h
6 #define WebThreadedDataReceiver_h
8 #include "public/platform/WebCommon.h"
9 #include "public/platform/WebPrivatePtr.h"
11 namespace blink {
13 class ThreadedDataReceiver;
14 class WebThread;
16 class WebThreadedDataReceiver {
17 public:
18 ~WebThreadedDataReceiver() { reset(); }
20 WebThreadedDataReceiver() { }
21 WebThreadedDataReceiver(const WebThreadedDataReceiver& r) { assign(r); }
22 WebThreadedDataReceiver& operator=(const WebThreadedDataReceiver& r)
24 assign(r);
25 return *this;
28 BLINK_PLATFORM_EXPORT void reset();
29 BLINK_PLATFORM_EXPORT void assign(const WebThreadedDataReceiver&);
31 bool isNull() const { return m_private.isNull(); }
33 #if INSIDE_BLINK
34 BLINK_PLATFORM_EXPORT explicit WebThreadedDataReceiver(const PassRefPtrWillBeRawPtr<ThreadedDataReceiver>&);
35 #endif
37 BLINK_PLATFORM_EXPORT void acceptData(const char* data, int dataLength);
38 BLINK_PLATFORM_EXPORT WebThread* backgroundThread();
40 BLINK_PLATFORM_EXPORT bool needsMainthreadDataCopy();
41 BLINK_PLATFORM_EXPORT void acceptMainthreadDataNotification(const char* data, int dataLength, int encodedDataLength);
43 private:
44 WebPrivatePtr<ThreadedDataReceiver> m_private;
47 } // namespace blink
49 #endif // WebThreadedDataReceiver_h