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

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

Issue 1895873006: compositor-worker: Initialize CW machinery plumbing to compositor and fire CW rAF callbacks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add big fat TODOs in scheduler code to implement proper idle task scheduling and ensure GC is runniā€¦ 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/CompositorProxyClient.h"
8 #include "core/dom/Document.h" 9 #include "core/dom/Document.h"
9 #include "core/dom/ExceptionCode.h" 10 #include "core/dom/ExceptionCode.h"
11 #include "core/page/ChromeClient.h"
10 #include "core/workers/WorkerClients.h" 12 #include "core/workers/WorkerClients.h"
11 #include "modules/EventTargetModules.h" 13 #include "modules/EventTargetModules.h"
12 #include "modules/compositorworker/CompositorWorkerMessagingProxy.h" 14 #include "modules/compositorworker/CompositorWorkerMessagingProxy.h"
15 #include "modules/compositorworker/CompositorWorkerThread.h"
13 16
14 namespace blink { 17 namespace blink {
15 18
16 inline CompositorWorker::CompositorWorker(ExecutionContext* context) 19 inline CompositorWorker::CompositorWorker(ExecutionContext* context)
17 : InProcessWorkerBase(context) 20 : InProcessWorkerBase(context)
18 { 21 {
19 } 22 }
20 23
21 CompositorWorker* CompositorWorker::create(ExecutionContext* context, const Stri ng& url, ExceptionState& exceptionState) 24 CompositorWorker* CompositorWorker::create(ExecutionContext* context, const Stri ng& url, ExceptionState& exceptionState)
22 { 25 {
26 // Ensure the compositor worker backing thread is ready.
27 CompositorWorkerThread::ensureSharedBackingThread();
haraken 2016/05/06 02:45:51 Should we call this after worker->initialize has f
flackr 2016/05/06 18:15:07 Unless I'm mistaken, we have to ensure the shared
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* context)
46 { 52 {
47 ASSERT(getExecutionContext()->isDocument()); 53 Document* document = toDocument(context);
48 return new CompositorWorkerMessagingProxy(this); 54 WorkerClients* workerClients = WorkerClients::create();
55 provideCompositorProxyClientTo(workerClients, document->frame()->chromeClien t().createCompositorProxyClient());
haraken 2016/05/06 02:45:51 I'm not sure if this is a good way to inject the w
56 return new CompositorWorkerMessagingProxy(this, workerClients);
49 } 57 }
50 58
51 } // namespace blink 59 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698