OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef WebThreadedDataReceiver_h | 5 #ifndef WebThreadedDataReceiver_h |
6 #define WebThreadedDataReceiver_h | 6 #define WebThreadedDataReceiver_h |
7 | 7 |
| 8 #include "public/platform/WebPrivatePtr.h" |
| 9 |
8 namespace blink { | 10 namespace blink { |
9 | 11 |
| 12 class ThreadedDataReceiver; |
10 class WebThread; | 13 class WebThread; |
11 | 14 |
12 class WebThreadedDataReceiver { | 15 class WebThreadedDataReceiver { |
13 public: | 16 public: |
14 virtual void acceptData(const char* data, int dataLength) = 0; | 17 ~WebThreadedDataReceiver() { reset(); } |
15 virtual WebThread* backgroundThread() = 0; | |
16 | 18 |
17 virtual bool needsMainthreadDataCopy() = 0; | 19 WebThreadedDataReceiver() { } |
18 virtual void acceptMainthreadDataNotification(const char* data, int dataLeng
th, int encodedDataLength) = 0; | 20 WebThreadedDataReceiver(const WebThreadedDataReceiver& r) { assign(r); } |
| 21 WebThreadedDataReceiver& operator=(const WebThreadedDataReceiver& r) |
| 22 { |
| 23 assign(r); |
| 24 return *this; |
| 25 } |
19 | 26 |
20 virtual ~WebThreadedDataReceiver() { } | 27 BLINK_EXPORT void reset(); |
| 28 BLINK_EXPORT void assign(const WebThreadedDataReceiver&); |
| 29 |
| 30 bool isNull() const { return m_private.isNull(); } |
| 31 |
| 32 #if BLINK_IMPLEMENTATION |
| 33 explicit WebThreadedDataReceiver(const PassRefPtrWillBeRawPtr<ThreadedDataRe
ceiver>&); |
| 34 #endif |
| 35 |
| 36 BLINK_EXPORT void acceptData(const char* data, int dataLength); |
| 37 BLINK_EXPORT WebThread* backgroundThread(); |
| 38 |
| 39 BLINK_EXPORT bool needsMainthreadDataCopy(); |
| 40 BLINK_EXPORT void acceptMainthreadDataNotification(const char* data, int dat
aLength, int encodedDataLength); |
| 41 |
| 42 private: |
| 43 WebPrivatePtr<ThreadedDataReceiver> m_private; |
21 }; | 44 }; |
22 | 45 |
23 } // namespace blink | 46 } // namespace blink |
24 | 47 |
25 #endif | 48 #endif // WebThreadedDataReceiver_h |
OLD | NEW |