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

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

Issue 1303153005: Introduce WebTaskRunner Patch 3/5 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add missing #include Created 5 years, 3 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 "config.h" 5 #include "config.h"
6 #include "modules/fetch/DataConsumerHandleUtil.h" 6 #include "modules/fetch/DataConsumerHandleUtil.h"
7 7
8 #include "platform/Task.h" 8 #include "platform/Task.h"
9 #include "platform/blob/BlobData.h" 9 #include "platform/blob/BlobData.h"
10 #include "public/platform/Platform.h" 10 #include "public/platform/Platform.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 return adoptPtr(new WebToFetchDataConsumerHandleAdapter(handle)); 133 return adoptPtr(new WebToFetchDataConsumerHandleAdapter(handle));
134 } 134 }
135 135
136 NotifyOnReaderCreationHelper::NotifyOnReaderCreationHelper(WebDataConsumerHandle ::Client* client) 136 NotifyOnReaderCreationHelper::NotifyOnReaderCreationHelper(WebDataConsumerHandle ::Client* client)
137 : m_factory(this) 137 : m_factory(this)
138 { 138 {
139 if (!client) 139 if (!client)
140 return; 140 return;
141 // Note we don't need thread safety here because this object is 141 // Note we don't need thread safety here because this object is
142 // bound to the current thread. 142 // bound to the current thread.
143 Platform::current()->currentThread()->postTask(FROM_HERE, new Task(bind(&Not ifyOnReaderCreationHelper::notify, m_factory.createWeakPtr(), client))); 143 Platform::current()->currentThread()->taskRunner()->postTask(FROM_HERE, new Task(bind(&NotifyOnReaderCreationHelper::notify, m_factory.createWeakPtr(), clie nt)));
144 } 144 }
145 145
146 void NotifyOnReaderCreationHelper::notify(WebDataConsumerHandle::Client* client) 146 void NotifyOnReaderCreationHelper::notify(WebDataConsumerHandle::Client* client)
147 { 147 {
148 // |client| dereference is safe here because: 148 // |client| dereference is safe here because:
149 // - |this| is owned by a reader, 149 // - |this| is owned by a reader,
150 // so the reader outlives |this|, and 150 // so the reader outlives |this|, and
151 // - |client| is the client of the reader, so |client| outlives the reader 151 // - |client| is the client of the reader, so |client| outlives the reader
152 // (guaranteed by the user of the reader), 152 // (guaranteed by the user of the reader),
153 // and therefore |client| outlives |this|. 153 // and therefore |client| outlives |this|.
154 client->didGetReadable(); 154 client->didGetReadable();
155 } 155 }
156 156
157 } // namespace blink 157 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/fetch/DataConsumerHandleTestUtil.cpp ('k') | Source/modules/fetch/DataConsumerTee.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698