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

Side by Side Diff: third_party/WebKit/Source/modules/compositorworker/CompositorWorker.cpp

Issue 2862963003: Replace ASSERT with DCHECK in modules/ (Closed)
Patch Set: NOTREACHED instead of DCHECK(false) Created 3 years, 7 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 "modules/compositorworker/CompositorWorker.h" 5 #include "modules/compositorworker/CompositorWorker.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "core/dom/CompositorWorkerProxyClient.h" 8 #include "core/dom/CompositorWorkerProxyClient.h"
9 #include "core/dom/Document.h" 9 #include "core/dom/Document.h"
10 #include "core/dom/ExceptionCode.h" 10 #include "core/dom/ExceptionCode.h"
11 #include "core/frame/LocalFrame.h" 11 #include "core/frame/LocalFrame.h"
12 #include "core/page/ChromeClient.h" 12 #include "core/page/ChromeClient.h"
13 #include "core/workers/WorkerClients.h" 13 #include "core/workers/WorkerClients.h"
14 #include "modules/EventTargetModules.h" 14 #include "modules/EventTargetModules.h"
15 #include "modules/compositorworker/CompositorWorkerMessagingProxy.h" 15 #include "modules/compositorworker/CompositorWorkerMessagingProxy.h"
16 #include "modules/compositorworker/CompositorWorkerThread.h" 16 #include "modules/compositorworker/CompositorWorkerThread.h"
17 17
18 namespace blink { 18 namespace blink {
19 19
20 inline CompositorWorker::CompositorWorker(ExecutionContext* context) 20 inline CompositorWorker::CompositorWorker(ExecutionContext* context)
21 : InProcessWorkerBase(context) {} 21 : InProcessWorkerBase(context) {}
22 22
23 CompositorWorker* CompositorWorker::Create(ExecutionContext* context, 23 CompositorWorker* CompositorWorker::Create(ExecutionContext* context,
24 const String& url, 24 const String& url,
25 ExceptionState& exception_state) { 25 ExceptionState& exception_state) {
26 ASSERT(IsMainThread()); 26 DCHECK(IsMainThread());
27 Document* document = ToDocument(context); 27 Document* document = ToDocument(context);
28 if (!document->GetPage()) { 28 if (!document->GetPage()) {
29 exception_state.ThrowDOMException(kInvalidAccessError, 29 exception_state.ThrowDOMException(kInvalidAccessError,
30 "The context provided is invalid."); 30 "The context provided is invalid.");
31 return nullptr; 31 return nullptr;
32 } 32 }
33 CompositorWorker* worker = new CompositorWorker(context); 33 CompositorWorker* worker = new CompositorWorker(context);
34 34
35 // Ensure the compositor worker backing thread is ready before we try to 35 // Ensure the compositor worker backing thread is ready before we try to
36 // initialize the CompositorWorker so that we can construct oilpan 36 // initialize the CompositorWorker so that we can construct oilpan
37 // objects on the compositor thread referenced from the worker clients. 37 // objects on the compositor thread referenced from the worker clients.
38 CompositorWorkerThread::EnsureSharedBackingThread(); 38 CompositorWorkerThread::EnsureSharedBackingThread();
39 39
40 if (worker->Initialize(context, url, exception_state)) 40 if (worker->Initialize(context, url, exception_state))
41 return worker; 41 return worker;
42 return nullptr; 42 return nullptr;
43 } 43 }
44 44
45 CompositorWorker::~CompositorWorker() { 45 CompositorWorker::~CompositorWorker() {
46 ASSERT(IsMainThread()); 46 DCHECK(IsMainThread());
47 } 47 }
48 48
49 const AtomicString& CompositorWorker::InterfaceName() const { 49 const AtomicString& CompositorWorker::InterfaceName() const {
50 return EventTargetNames::CompositorWorker; 50 return EventTargetNames::CompositorWorker;
51 } 51 }
52 52
53 InProcessWorkerMessagingProxy* 53 InProcessWorkerMessagingProxy*
54 CompositorWorker::CreateInProcessWorkerMessagingProxy( 54 CompositorWorker::CreateInProcessWorkerMessagingProxy(
55 ExecutionContext* context) { 55 ExecutionContext* context) {
56 Document* document = ToDocument(context); 56 Document* document = ToDocument(context);
57 WorkerClients* worker_clients = WorkerClients::Create(); 57 WorkerClients* worker_clients = WorkerClients::Create();
58 CompositorWorkerProxyClient* client = 58 CompositorWorkerProxyClient* client =
59 document->GetFrame()->GetChromeClient().CreateCompositorWorkerProxyClient( 59 document->GetFrame()->GetChromeClient().CreateCompositorWorkerProxyClient(
60 document->GetFrame()); 60 document->GetFrame());
61 ProvideCompositorWorkerProxyClientTo(worker_clients, client); 61 ProvideCompositorWorkerProxyClientTo(worker_clients, client);
62 return new CompositorWorkerMessagingProxy(this, worker_clients); 62 return new CompositorWorkerMessagingProxy(this, worker_clients);
63 } 63 }
64 64
65 } // namespace blink 65 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698