| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 DataConsumerHandleUtil_h | 5 #ifndef DataConsumerHandleUtil_h |
| 6 #define DataConsumerHandleUtil_h | 6 #define DataConsumerHandleUtil_h |
| 7 | 7 |
| 8 #include "modules/ModulesExport.h" | 8 #include "modules/ModulesExport.h" |
| 9 #include "modules/fetch/FetchDataConsumerHandle.h" | 9 #include "modules/fetch/FetchDataConsumerHandle.h" |
| 10 #include "public/platform/WebDataConsumerHandle.h" | 10 #include "public/platform/WebDataConsumerHandle.h" |
| 11 #include "wtf/PassOwnPtr.h" | 11 #include "wtf/PassOwnPtr.h" |
| 12 #include "wtf/WeakPtr.h" | 12 #include "wtf/WeakPtr.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 // Returns a handle that returns ShouldWait for read / beginRead and | 16 // Returns a handle that returns ShouldWait for read / beginRead and |
| 17 // UnexpectedError for endRead. | 17 // UnexpectedError for endRead. |
| 18 MODULES_EXPORT PassOwnPtr<WebDataConsumerHandle> createWaitingDataConsumerHandle
(); | 18 MODULES_EXPORT PassOwnPtr<WebDataConsumerHandle> createWaitingDataConsumerHandle
(); |
| 19 | 19 |
| 20 // Returns a handle that returns Done for read / beginRead and | 20 // Returns a handle that returns Done for read / beginRead and |
| 21 // UnexpectedError for endRead. | 21 // UnexpectedError for endRead. |
| 22 MODULES_EXPORT PassOwnPtr<WebDataConsumerHandle> createDoneDataConsumerHandle(); | 22 MODULES_EXPORT PassOwnPtr<WebDataConsumerHandle> createDoneDataConsumerHandle(); |
| 23 | 23 |
| 24 // Returns a handle that returns UnexpectedError for read / beginRead / | 24 // Returns a handle that returns UnexpectedError for read / beginRead / |
| 25 // endRead. | 25 // endRead. |
| 26 MODULES_EXPORT PassOwnPtr<WebDataConsumerHandle> createUnexpectedErrorDataConsum
erHandle(); | 26 MODULES_EXPORT PassOwnPtr<WebDataConsumerHandle> createUnexpectedErrorDataConsum
erHandle(); |
| 27 | 27 |
| 28 // Returns a FetchDataConsumerHandle that wraps WebDataConsumerHandle. | 28 // Returns a FetchDataConsumerHandle that wraps WebDataConsumerHandle. |
| 29 PassOwnPtr<FetchDataConsumerHandle> createFetchDataConsumerHandleFromWebHandle(P
assOwnPtr<WebDataConsumerHandle>); | 29 MODULES_EXPORT PassOwnPtr<FetchDataConsumerHandle> createFetchDataConsumerHandle
FromWebHandle(PassOwnPtr<WebDataConsumerHandle>); |
| 30 | 30 |
| 31 // A helper class to call Client::didGetReadable() asynchronously after | 31 // A helper class to call Client::didGetReadable() asynchronously after |
| 32 // Reader creation. | 32 // Reader creation. |
| 33 // NotifyOnReaderCreationHelper must be owned by a reader and | 33 // NotifyOnReaderCreationHelper must be owned by a reader and |
| 34 // |client| must be the client of the reader. | 34 // |client| must be the client of the reader. |
| 35 class NotifyOnReaderCreationHelper final { | 35 class NotifyOnReaderCreationHelper final { |
| 36 public: | 36 public: |
| 37 NotifyOnReaderCreationHelper(WebDataConsumerHandle::Client* /* client */); | 37 NotifyOnReaderCreationHelper(WebDataConsumerHandle::Client* /* client */); |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 void notify(WebDataConsumerHandle::Client*); | 40 void notify(WebDataConsumerHandle::Client*); |
| 41 | 41 |
| 42 WeakPtrFactory<NotifyOnReaderCreationHelper> m_factory; | 42 WeakPtrFactory<NotifyOnReaderCreationHelper> m_factory; |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 } // namespace blink | 45 } // namespace blink |
| 46 | 46 |
| 47 #endif // DataConsumerHandleUtil_h | 47 #endif // DataConsumerHandleUtil_h |
| OLD | NEW |