OLD | NEW |
| (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 } | |
OLD | NEW |