Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Side by Side Diff: third_party/WebKit/Source/modules/fetch/DataConsumerHandleUtil.h

Issue 2177243002: Use per-frame TaskRunner instead of thread's default in DataConsumerHandle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@data_consumer_handle_unique_ptr
Patch Set: update Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/Allocator.h" 11 #include "wtf/Allocator.h"
12 #include "wtf/WeakPtr.h" 12 #include "wtf/WeakPtr.h"
13 #include <memory> 13 #include <memory>
14 14
15 namespace blink { 15 namespace blink {
16 16
17 class WebTaskRunner;
18
17 // Returns a handle that returns ShouldWait for read / beginRead and 19 // Returns a handle that returns ShouldWait for read / beginRead and
18 // UnexpectedError for endRead. 20 // UnexpectedError for endRead.
19 MODULES_EXPORT std::unique_ptr<WebDataConsumerHandle> createWaitingDataConsumerH andle(); 21 MODULES_EXPORT std::unique_ptr<WebDataConsumerHandle> createWaitingDataConsumerH andle();
20 22
21 // Returns a handle that returns Done for read / beginRead and 23 // Returns a handle that returns Done for read / beginRead and
22 // UnexpectedError for endRead. 24 // UnexpectedError for endRead.
23 MODULES_EXPORT std::unique_ptr<WebDataConsumerHandle> createDoneDataConsumerHand le(); 25 MODULES_EXPORT std::unique_ptr<WebDataConsumerHandle> createDoneDataConsumerHand le();
24 26
25 // Returns a handle that returns UnexpectedError for read / beginRead / 27 // Returns a handle that returns UnexpectedError for read / beginRead /
26 // endRead. 28 // endRead.
27 MODULES_EXPORT std::unique_ptr<WebDataConsumerHandle> createUnexpectedErrorDataC onsumerHandle(); 29 MODULES_EXPORT std::unique_ptr<WebDataConsumerHandle> createUnexpectedErrorDataC onsumerHandle();
28 30
29 // Returns a FetchDataConsumerHandle that wraps WebDataConsumerHandle. 31 // Returns a FetchDataConsumerHandle that wraps WebDataConsumerHandle.
30 MODULES_EXPORT std::unique_ptr<FetchDataConsumerHandle> createFetchDataConsumerH andleFromWebHandle(std::unique_ptr<WebDataConsumerHandle>); 32 MODULES_EXPORT std::unique_ptr<FetchDataConsumerHandle> createFetchDataConsumerH andleFromWebHandle(std::unique_ptr<WebDataConsumerHandle>);
31 33
32 // A helper class to call Client::didGetReadable() asynchronously after 34 // A helper class to call Client::didGetReadable() asynchronously after
33 // Reader creation. 35 // Reader creation.
34 // NotifyOnReaderCreationHelper must be owned by a reader and 36 // NotifyOnReaderCreationHelper must be owned by a reader and
35 // |client| must be the client of the reader. 37 // |client| must be the client of the reader.
36 class NotifyOnReaderCreationHelper final { 38 class NotifyOnReaderCreationHelper final {
37 DISALLOW_NEW(); 39 DISALLOW_NEW();
38 public: 40 public:
39 NotifyOnReaderCreationHelper(WebDataConsumerHandle::Client* /* client */); 41 NotifyOnReaderCreationHelper(WebDataConsumerHandle::Client*, WebTaskRunner*) ;
40 42
41 private: 43 private:
42 void notify(WebDataConsumerHandle::Client*); 44 void notify(WebDataConsumerHandle::Client*);
43 45
44 WeakPtrFactory<NotifyOnReaderCreationHelper> m_factory; 46 WeakPtrFactory<NotifyOnReaderCreationHelper> m_factory;
45 }; 47 };
46 48
47 } // namespace blink 49 } // namespace blink
48 50
49 #endif // DataConsumerHandleUtil_h 51 #endif // DataConsumerHandleUtil_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698