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

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

Issue 1955693003: compositor-worker: Keep worker backing thread alive for the lifetime of the compositor thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Expand on comments. Created 4 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/Document.h" 8 #include "core/dom/Document.h"
9 #include "core/dom/ExceptionCode.h" 9 #include "core/dom/ExceptionCode.h"
10 #include "core/workers/WorkerClients.h" 10 #include "core/workers/WorkerClients.h"
11 #include "modules/EventTargetModules.h" 11 #include "modules/EventTargetModules.h"
12 #include "modules/compositorworker/CompositorWorkerMessagingProxy.h" 12 #include "modules/compositorworker/CompositorWorkerMessagingProxy.h"
13 #include "modules/compositorworker/CompositorWorkerThread.h"
13 14
14 namespace blink { 15 namespace blink {
15 16
16 inline CompositorWorker::CompositorWorker(ExecutionContext* context) 17 inline CompositorWorker::CompositorWorker(ExecutionContext* context)
17 : InProcessWorkerBase(context) 18 : InProcessWorkerBase(context)
18 { 19 {
19 } 20 }
20 21
21 CompositorWorker* CompositorWorker::create(ExecutionContext* context, const Stri ng& url, ExceptionState& exceptionState) 22 CompositorWorker* CompositorWorker::create(ExecutionContext* context, const Stri ng& url, ExceptionState& exceptionState)
22 { 23 {
24 // Ensure the compositor worker backing thread is ready before we try to
25 // initialize the CompositorWorker so that we can construct oilpan
26 // objects on the compositor thread referenced from the worker clients.
27 CompositorWorkerThread::ensureSharedBackingThread();
haraken 2016/05/11 00:18:31 Sorry for not being clear: I'm suggesting to move
flackr 2016/05/18 05:26:50 Ah, my apologies. Done.
28
23 ASSERT(isMainThread()); 29 ASSERT(isMainThread());
24 Document* document = toDocument(context); 30 Document* document = toDocument(context);
25 if (!document->page()) { 31 if (!document->page()) {
26 exceptionState.throwDOMException(InvalidAccessError, "The context provid ed is invalid."); 32 exceptionState.throwDOMException(InvalidAccessError, "The context provid ed is invalid.");
27 return nullptr; 33 return nullptr;
28 } 34 }
29 CompositorWorker* worker = new CompositorWorker(context); 35 CompositorWorker* worker = new CompositorWorker(context);
30 if (worker->initialize(context, url, exceptionState)) 36 if (worker->initialize(context, url, exceptionState))
31 return worker; 37 return worker;
32 return nullptr; 38 return nullptr;
33 } 39 }
34 40
35 CompositorWorker::~CompositorWorker() 41 CompositorWorker::~CompositorWorker()
36 { 42 {
37 ASSERT(isMainThread()); 43 ASSERT(isMainThread());
38 } 44 }
39 45
40 const AtomicString& CompositorWorker::interfaceName() const 46 const AtomicString& CompositorWorker::interfaceName() const
41 { 47 {
42 return EventTargetNames::CompositorWorker; 48 return EventTargetNames::CompositorWorker;
43 } 49 }
44 50
45 InProcessWorkerGlobalScopeProxy* CompositorWorker::createInProcessWorkerGlobalSc opeProxy(ExecutionContext* worker) 51 InProcessWorkerGlobalScopeProxy* CompositorWorker::createInProcessWorkerGlobalSc opeProxy(ExecutionContext* worker)
46 { 52 {
47 ASSERT(getExecutionContext()->isDocument()); 53 ASSERT(getExecutionContext()->isDocument());
48 return new CompositorWorkerMessagingProxy(this); 54 return new CompositorWorkerMessagingProxy(this);
49 } 55 }
50 56
51 } // namespace blink 57 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698