| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 return wrapUnique(new WebToFetchDataConsumerHandleAdapter(std::move(handle))
); | 124 return wrapUnique(new WebToFetchDataConsumerHandleAdapter(std::move(handle))
); |
| 125 } | 125 } |
| 126 | 126 |
| 127 NotifyOnReaderCreationHelper::NotifyOnReaderCreationHelper(WebDataConsumerHandle
::Client* client) | 127 NotifyOnReaderCreationHelper::NotifyOnReaderCreationHelper(WebDataConsumerHandle
::Client* client) |
| 128 : m_factory(this) | 128 : m_factory(this) |
| 129 { | 129 { |
| 130 if (!client) | 130 if (!client) |
| 131 return; | 131 return; |
| 132 // Note we don't need thread safety here because this object is | 132 // Note we don't need thread safety here because this object is |
| 133 // bound to the current thread. | 133 // bound to the current thread. |
| 134 Platform::current()->currentThread()->getWebTaskRunner()->postTask(BLINK_FRO
M_HERE, bind(&NotifyOnReaderCreationHelper::notify, m_factory.createWeakPtr(), W
TF::unretained(client))); | 134 Platform::current()->currentThread()->getWebTaskRunner()->postTask(BLINK_FRO
M_HERE, WTF::bind(&NotifyOnReaderCreationHelper::notify, m_factory.createWeakPtr
(), WTF::unretained(client))); |
| 135 } | 135 } |
| 136 | 136 |
| 137 void NotifyOnReaderCreationHelper::notify(WebDataConsumerHandle::Client* client) | 137 void NotifyOnReaderCreationHelper::notify(WebDataConsumerHandle::Client* client) |
| 138 { | 138 { |
| 139 // |client| dereference is safe here because: | 139 // |client| dereference is safe here because: |
| 140 // - |this| is owned by a reader, | 140 // - |this| is owned by a reader, |
| 141 // so the reader outlives |this|, and | 141 // so the reader outlives |this|, and |
| 142 // - |client| is the client of the reader, so |client| outlives the reader | 142 // - |client| is the client of the reader, so |client| outlives the reader |
| 143 // (guaranteed by the user of the reader), | 143 // (guaranteed by the user of the reader), |
| 144 // and therefore |client| outlives |this|. | 144 // and therefore |client| outlives |this|. |
| 145 client->didGetReadable(); | 145 client->didGetReadable(); |
| 146 } | 146 } |
| 147 | 147 |
| 148 } // namespace blink | 148 } // namespace blink |
| OLD | NEW |