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

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

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 #include "modules/fetch/DataConsumerHandleUtil.h" 5 #include "modules/fetch/DataConsumerHandleUtil.h"
6 6
7 #include "platform/blob/BlobData.h" 7 #include "platform/blob/BlobData.h"
8 #include "public/platform/Platform.h" 8 #include "public/platform/Platform.h"
9 #include "public/platform/WebTaskRunner.h" 9 #include "public/platform/WebTaskRunner.h"
10 #include "public/platform/WebThread.h" 10 #include "public/platform/WebThread.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 return wrapUnique(new WebToFetchDataConsumerHandleAdapter(std::move(handle)) ); 127 return wrapUnique(new WebToFetchDataConsumerHandleAdapter(std::move(handle)) );
128 } 128 }
129 129
130 NotifyOnReaderCreationHelper::NotifyOnReaderCreationHelper(WebDataConsumerHandle ::Client* client) 130 NotifyOnReaderCreationHelper::NotifyOnReaderCreationHelper(WebDataConsumerHandle ::Client* client)
131 : m_factory(this) 131 : m_factory(this)
132 { 132 {
133 if (!client) 133 if (!client)
134 return; 134 return;
135 // Note we don't need thread safety here because this object is 135 // Note we don't need thread safety here because this object is
136 // bound to the current thread. 136 // bound to the current thread.
137 Platform::current()->currentThread()->getWebTaskRunner()->postTask(BLINK_FRO M_HERE, WTF::bind(&NotifyOnReaderCreationHelper::notify, m_factory.createWeakPtr (), WTF::unretained(client))); 137 client->getTaskRunner()->postTask(BLINK_FROM_HERE, WTF::bind(&NotifyOnReader CreationHelper::notify, m_factory.createWeakPtr(), WTF::unretained(client)));
138 } 138 }
139 139
140 void NotifyOnReaderCreationHelper::notify(WebDataConsumerHandle::Client* client) 140 void NotifyOnReaderCreationHelper::notify(WebDataConsumerHandle::Client* client)
141 { 141 {
142 // |client| dereference is safe here because: 142 // |client| dereference is safe here because:
143 // - |this| is owned by a reader, 143 // - |this| is owned by a reader,
144 // so the reader outlives |this|, and 144 // so the reader outlives |this|, and
145 // - |client| is the client of the reader, so |client| outlives the reader 145 // - |client| is the client of the reader, so |client| outlives the reader
146 // (guaranteed by the user of the reader), 146 // (guaranteed by the user of the reader),
147 // and therefore |client| outlives |this|. 147 // and therefore |client| outlives |this|.
148 client->didGetReadable(); 148 client->didGetReadable();
149 } 149 }
150 150
151 } // namespace blink 151 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698