| 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 #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 Loading... |
| 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 |
| OLD | NEW |