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

Side by Side Diff: webkit/compositor_bindings/web_compositor_impl.cc

Issue 11232051: Remove static thread pointers from CC (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address code review comments and fix all cc_unittests Created 8 years, 1 month 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
(Empty)
1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "config.h"
6
7 #include "web_compositor_impl.h"
8
9 #ifdef LOG
10 #undef LOG
11 #endif
12 #include "base/message_loop_proxy.h"
13 #include "cc/layer_tree_host.h"
14 #include "cc/proxy.h"
15 #include "cc/settings.h"
16 #include "ccthread_impl.h"
17 #include "third_party/WebKit/Source/Platform/chromium/public/Platform.h"
18 #include "webkit/glue/webthread_impl.h"
19
20 using namespace cc;
21
22 namespace WebKit {
23
24 bool WebCompositorImpl::s_initialized = false;
25 Thread* WebCompositorImpl::s_mainThread = 0;
26 Thread* WebCompositorImpl::s_implThread = 0;
27
28 void WebCompositor::initialize(WebThread* implThread)
29 {
30 WebCompositorImpl::initialize(implThread);
31 }
32
33 bool WebCompositor::isThreadingEnabled()
34 {
35 return WebCompositorImpl::isThreadingEnabled();
36 }
37
38 void WebCompositor::shutdown()
39 {
40 WebCompositorImpl::shutdown();
41 }
42
43 void WebCompositorImpl::initialize(WebThread* implThread)
44 {
45 ASSERT(!s_initialized);
46 s_initialized = true;
47
48 s_mainThread = CCThreadImpl::createForCurrentThread().release();
49 Proxy::setMainThread(s_mainThread);
50 if (implThread) {
51 s_implThread = CCThreadImpl::createForDifferentThread(implThread).releas e();
52 Proxy::setImplThread(s_implThread);
53 } else
54 Proxy::setImplThread(0);
55 }
56
57 bool WebCompositorImpl::isThreadingEnabled()
58 {
59 return s_implThread;
60 }
61
62 bool WebCompositorImpl::initialized()
63 {
64 return s_initialized;
65 }
66
67 void WebCompositorImpl::shutdown()
68 {
69 ASSERT(s_initialized);
70 ASSERT(!LayerTreeHost::anyLayerTreeHostInstanceExists());
71
72 if (s_implThread) {
73 delete s_implThread;
74 s_implThread = 0;
75 }
76 delete s_mainThread;
77 s_mainThread = 0;
78 Proxy::setImplThread(0);
79 Proxy::setMainThread(0);
80 s_initialized = false;
81 }
82
83 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698