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

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

Issue 2570463005: Retire ThreadState::registerPreFinalizer<T>() (Closed)
Patch Set: Created 4 years 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/BlobBytesConsumer.h" 5 #include "modules/fetch/BlobBytesConsumer.h"
6 6
7 #include "core/fetch/FetchInitiatorTypeNames.h" 7 #include "core/fetch/FetchInitiatorTypeNames.h"
8 #include "core/loader/ThreadableLoader.h" 8 #include "core/loader/ThreadableLoader.h"
9 #include "modules/fetch/BytesConsumerForDataConsumerHandle.h" 9 #include "modules/fetch/BytesConsumerForDataConsumerHandle.h"
10 #include "platform/blob/BlobData.h" 10 #include "platform/blob/BlobData.h"
11 #include "platform/blob/BlobRegistry.h" 11 #include "platform/blob/BlobRegistry.h"
12 #include "platform/blob/BlobURL.h" 12 #include "platform/blob/BlobURL.h"
13 #include "platform/network/ResourceError.h" 13 #include "platform/network/ResourceError.h"
14 #include "platform/network/ResourceRequest.h" 14 #include "platform/network/ResourceRequest.h"
15 #include "platform/weborigin/KURL.h" 15 #include "platform/weborigin/KURL.h"
16 #include "platform/weborigin/SecurityOrigin.h" 16 #include "platform/weborigin/SecurityOrigin.h"
17 17
18 namespace blink { 18 namespace blink {
19 19
20 BlobBytesConsumer::BlobBytesConsumer(ExecutionContext* executionContext, 20 BlobBytesConsumer::BlobBytesConsumer(ExecutionContext* executionContext,
21 PassRefPtr<BlobDataHandle> blobDataHandle, 21 PassRefPtr<BlobDataHandle> blobDataHandle,
22 ThreadableLoader* loader) 22 ThreadableLoader* loader)
23 : ContextLifecycleObserver(executionContext), 23 : ContextLifecycleObserver(executionContext),
24 m_blobDataHandle(blobDataHandle), 24 m_blobDataHandle(blobDataHandle),
25 m_loader(loader) { 25 m_loader(loader) {
26 ThreadState::current()->registerPreFinalizer(this);
27 if (!m_blobDataHandle) { 26 if (!m_blobDataHandle) {
28 // Note that |m_loader| is non-null only in tests. 27 // Note that |m_loader| is non-null only in tests.
29 if (m_loader) { 28 if (m_loader) {
30 m_loader->cancel(); 29 m_loader->cancel();
31 m_loader = nullptr; 30 m_loader = nullptr;
32 } 31 }
33 m_state = PublicState::Closed; 32 m_state = PublicState::Closed;
34 } 33 }
35 } 34 }
36 35
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 void BlobBytesConsumer::clear() { 303 void BlobBytesConsumer::clear() {
305 DCHECK_NE(m_state, PublicState::ReadableOrWaiting); 304 DCHECK_NE(m_state, PublicState::ReadableOrWaiting);
306 if (m_loader) { 305 if (m_loader) {
307 m_loader->cancel(); 306 m_loader->cancel();
308 m_loader = nullptr; 307 m_loader = nullptr;
309 } 308 }
310 m_client = nullptr; 309 m_client = nullptr;
311 } 310 }
312 311
313 } // namespace blink 312 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698