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

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

Issue 2103823002: Disallow raw pointers in CrossThreadCopier/threadSafeBind() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: bug fix. Created 4 years, 5 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandleTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/CompositeDataConsumerHandle.h" 5 #include "modules/fetch/CompositeDataConsumerHandle.h"
6 6
7 #include "platform/ThreadSafeFunctional.h" 7 #include "platform/ThreadSafeFunctional.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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 // We are waiting for the two-phase read completion. 135 // We are waiting for the two-phase read completion.
136 m_isUpdateWaitingForEndRead = true; 136 m_isUpdateWaitingForEndRead = true;
137 return; 137 return;
138 } 138 }
139 // Unregister the old one, then register the new one. 139 // Unregister the old one, then register the new one.
140 m_reader = nullptr; 140 m_reader = nullptr;
141 m_reader = m_handle->obtainReader(m_client); 141 m_reader = m_handle->obtainReader(m_client);
142 return; 142 return;
143 } 143 }
144 ++m_token; 144 ++m_token;
145 m_readerThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafe Bind(&Context::updateReader, this, m_token)); 145 m_readerThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafe Bind(&Context::updateReader, wrapPassRefPtr(this), m_token));
146 } 146 }
147 147
148 std::unique_ptr<Reader> m_reader; 148 std::unique_ptr<Reader> m_reader;
149 std::unique_ptr<WebDataConsumerHandle> m_handle; 149 std::unique_ptr<WebDataConsumerHandle> m_handle;
150 // Note: Holding a WebThread raw pointer is not generally safe, but we can 150 // Note: Holding a WebThread raw pointer is not generally safe, but we can
151 // do that in this case because: 151 // do that in this case because:
152 // 1. Destructing a ReaderImpl when the bound thread ends is a user's 152 // 1. Destructing a ReaderImpl when the bound thread ends is a user's
153 // responsibility. 153 // responsibility.
154 // 2. |m_readerThread| will never be used after the associated reader is 154 // 2. |m_readerThread| will never be used after the associated reader is
155 // detached. 155 // detached.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 } 208 }
209 209
210 CompositeDataConsumerHandle::~CompositeDataConsumerHandle() { } 210 CompositeDataConsumerHandle::~CompositeDataConsumerHandle() { }
211 211
212 WebDataConsumerHandle::Reader* CompositeDataConsumerHandle::obtainReaderInternal (Client* client) 212 WebDataConsumerHandle::Reader* CompositeDataConsumerHandle::obtainReaderInternal (Client* client)
213 { 213 {
214 return m_context->obtainReader(client).release(); 214 return m_context->obtainReader(client).release();
215 } 215 }
216 216
217 } // namespace blink 217 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandleTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698