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

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

Issue 1547893003: WIP - compositor worker mega patch. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 "config.h" 5 #include "config.h"
6 #include "modules/compositorworker/CompositorWorker.h" 6 #include "modules/compositorworker/CompositorWorker.h"
7 7
8 #include "bindings/core/v8/ExceptionState.h" 8 #include "bindings/core/v8/ExceptionState.h"
9 #include "core/dom/CompositorProxyClient.h"
9 #include "core/dom/Document.h" 10 #include "core/dom/Document.h"
10 #include "core/dom/ExceptionCode.h" 11 #include "core/dom/ExceptionCode.h"
12 #include "core/page/ChromeClient.h"
11 #include "core/workers/WorkerClients.h" 13 #include "core/workers/WorkerClients.h"
12 #include "modules/EventTargetModules.h" 14 #include "modules/EventTargetModules.h"
13 #include "modules/compositorworker/CompositorWorkerMessagingProxy.h" 15 #include "modules/compositorworker/CompositorWorkerMessagingProxy.h"
16 #include "platform/TraceEvent.h"
14 #include "wtf/MainThread.h" 17 #include "wtf/MainThread.h"
15 18
16 namespace blink { 19 namespace blink {
17 20
18 inline CompositorWorker::CompositorWorker(ExecutionContext* context) 21 inline CompositorWorker::CompositorWorker(ExecutionContext* context)
19 : InProcessWorkerBase(context) 22 : InProcessWorkerBase(context)
20 { 23 {
21 } 24 }
22 25
23 CompositorWorker* CompositorWorker::create(ExecutionContext* context, const Stri ng& url, ExceptionState& exceptionState) 26 CompositorWorker* CompositorWorker::create(ExecutionContext* context, const Stri ng& url, ExceptionState& exceptionState)
24 { 27 {
28 TRACE_EVENT0("compositor-worker", "CompositorWorker::create");
25 ASSERT(isMainThread()); 29 ASSERT(isMainThread());
26 Document* document = toDocument(context); 30 Document* document = toDocument(context);
27 if (!document->page()) { 31 if (!document->page()) {
28 exceptionState.throwDOMException(InvalidAccessError, "The context provid ed is invalid."); 32 exceptionState.throwDOMException(InvalidAccessError, "The context provid ed is invalid.");
29 return nullptr; 33 return nullptr;
30 } 34 }
31 CompositorWorker* worker = new CompositorWorker(context); 35 CompositorWorker* worker = new CompositorWorker(context);
32 if (worker->initialize(context, url, exceptionState)) 36 if (worker->initialize(context, url, exceptionState))
33 return worker; 37 return worker;
34 return nullptr; 38 return nullptr;
35 } 39 }
36 40
37 CompositorWorker::~CompositorWorker() 41 CompositorWorker::~CompositorWorker()
38 { 42 {
43 TRACE_EVENT0("compositor-worker", "CompositorWorker::~CompositorWorker");
39 ASSERT(isMainThread()); 44 ASSERT(isMainThread());
40 } 45 }
41 46
42 const AtomicString& CompositorWorker::interfaceName() const 47 const AtomicString& CompositorWorker::interfaceName() const
43 { 48 {
44 return EventTargetNames::CompositorWorker; 49 return EventTargetNames::CompositorWorker;
45 } 50 }
46 51
47 WorkerGlobalScopeProxy* CompositorWorker::createWorkerGlobalScopeProxy(Execution Context* worker) 52 WorkerGlobalScopeProxy* CompositorWorker::createWorkerGlobalScopeProxy(Execution Context* context)
48 { 53 {
49 ASSERT(executionContext()->isDocument()); 54 TRACE_EVENT0("compositor-worker", "CompositorWorker::createWorkerGlobalScope Proxy");
50 return new CompositorWorkerMessagingProxy(this); 55 ASSERT(context->isDocument());
56 Document* document = toDocument(context);
57 OwnPtrWillBeRawPtr<WorkerClients> workerClients = WorkerClients::create();
58 provideCompositorProxyClientTo(workerClients.get(), adoptPtrWillBeNoop(docum ent->frame()->chromeClient().createCompositorProxyClient()));
59 return new CompositorWorkerMessagingProxy(this, workerClients.release());
51 } 60 }
52 61
53 } // namespace blink 62 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698