OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 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 | 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 | 6 |
7 #include "WebCompositorImpl.h" | 7 #include "WebCompositorImpl.h" |
8 | 8 |
9 #ifdef LOG | 9 #ifdef LOG |
10 #undef LOG | 10 #undef LOG |
11 #endif | 11 #endif |
12 #include "base/message_loop_proxy.h" | 12 #include "base/message_loop_proxy.h" |
13 #include "cc/layer_tree_host.h" | 13 #include "cc/layer_tree_host.h" |
14 #include "cc/proxy.h" | 14 #include "cc/proxy.h" |
15 #include "cc/settings.h" | 15 #include "cc/settings.h" |
16 #include "third_party/WebKit/Source/Platform/chromium/public/Platform.h" | 16 #include "third_party/WebKit/Source/Platform/chromium/public/Platform.h" |
17 #include "webkit/glue/webthread_impl.h" | 17 #include "webkit/glue/webthread_impl.h" |
18 #include "CCThreadImpl.h" | 18 #include "CCThreadImpl.h" |
19 | 19 |
20 using namespace cc; | 20 using namespace cc; |
21 | 21 |
22 namespace WebKit { | 22 namespace WebKit { |
23 | 23 |
24 bool WebCompositorImpl::s_initialized = false; | 24 bool WebCompositorImpl::s_initialized = false; |
25 CCThread* WebCompositorImpl::s_mainThread = 0; | 25 Thread* WebCompositorImpl::s_mainThread = 0; |
26 CCThread* WebCompositorImpl::s_implThread = 0; | 26 Thread* WebCompositorImpl::s_implThread = 0; |
27 | 27 |
28 void WebCompositor::initialize(WebThread* implThread) | 28 void WebCompositor::initialize(WebThread* implThread) |
29 { | 29 { |
30 WebCompositorImpl::initialize(implThread); | 30 WebCompositorImpl::initialize(implThread); |
31 } | 31 } |
32 | 32 |
33 bool WebCompositor::isThreadingEnabled() | 33 bool WebCompositor::isThreadingEnabled() |
34 { | 34 { |
35 return WebCompositorImpl::isThreadingEnabled(); | 35 return WebCompositorImpl::isThreadingEnabled(); |
36 } | 36 } |
37 | 37 |
38 void WebCompositor::shutdown() | 38 void WebCompositor::shutdown() |
39 { | 39 { |
40 WebCompositorImpl::shutdown(); | 40 WebCompositorImpl::shutdown(); |
41 CCSettings::reset(); | 41 Settings::reset(); |
42 } | 42 } |
43 | 43 |
44 void WebCompositor::setPerTilePaintingEnabled(bool enabled) | 44 void WebCompositor::setPerTilePaintingEnabled(bool enabled) |
45 { | 45 { |
46 ASSERT(!WebCompositorImpl::initialized()); | 46 ASSERT(!WebCompositorImpl::initialized()); |
47 CCSettings::setPerTilePaintingEnabled(enabled); | 47 Settings::setPerTilePaintingEnabled(enabled); |
48 } | 48 } |
49 | 49 |
50 void WebCompositor::setPartialSwapEnabled(bool enabled) | 50 void WebCompositor::setPartialSwapEnabled(bool enabled) |
51 { | 51 { |
52 ASSERT(!WebCompositorImpl::initialized()); | 52 ASSERT(!WebCompositorImpl::initialized()); |
53 CCSettings::setPartialSwapEnabled(enabled); | 53 Settings::setPartialSwapEnabled(enabled); |
54 } | 54 } |
55 | 55 |
56 void WebCompositor::setAcceleratedAnimationEnabled(bool enabled) | 56 void WebCompositor::setAcceleratedAnimationEnabled(bool enabled) |
57 { | 57 { |
58 ASSERT(!WebCompositorImpl::initialized()); | 58 ASSERT(!WebCompositorImpl::initialized()); |
59 CCSettings::setAcceleratedAnimationEnabled(enabled); | 59 Settings::setAcceleratedAnimationEnabled(enabled); |
60 } | 60 } |
61 | 61 |
62 void WebCompositor::setPageScalePinchZoomEnabled(bool enabled) | 62 void WebCompositor::setPageScalePinchZoomEnabled(bool enabled) |
63 { | 63 { |
64 ASSERT(!WebCompositorImpl::initialized()); | 64 ASSERT(!WebCompositorImpl::initialized()); |
65 CCSettings::setPageScalePinchZoomEnabled(enabled); | 65 Settings::setPageScalePinchZoomEnabled(enabled); |
66 } | 66 } |
67 | 67 |
68 void WebCompositorImpl::initialize(WebThread* implThread) | 68 void WebCompositorImpl::initialize(WebThread* implThread) |
69 { | 69 { |
70 ASSERT(!s_initialized); | 70 ASSERT(!s_initialized); |
71 s_initialized = true; | 71 s_initialized = true; |
72 | 72 |
73 s_mainThread = CCThreadImpl::createForCurrentThread().release(); | 73 s_mainThread = CCThreadImpl::createForCurrentThread().release(); |
74 CCProxy::setMainThread(s_mainThread); | 74 Proxy::setMainThread(s_mainThread); |
75 if (implThread) { | 75 if (implThread) { |
76 s_implThread = CCThreadImpl::createForDifferentThread(implThread).releas
e(); | 76 s_implThread = CCThreadImpl::createForDifferentThread(implThread).releas
e(); |
77 CCProxy::setImplThread(s_implThread); | 77 Proxy::setImplThread(s_implThread); |
78 } else | 78 } else |
79 CCProxy::setImplThread(0); | 79 Proxy::setImplThread(0); |
80 } | 80 } |
81 | 81 |
82 bool WebCompositorImpl::isThreadingEnabled() | 82 bool WebCompositorImpl::isThreadingEnabled() |
83 { | 83 { |
84 return s_implThread; | 84 return s_implThread; |
85 } | 85 } |
86 | 86 |
87 bool WebCompositorImpl::initialized() | 87 bool WebCompositorImpl::initialized() |
88 { | 88 { |
89 return s_initialized; | 89 return s_initialized; |
90 } | 90 } |
91 | 91 |
92 void WebCompositorImpl::shutdown() | 92 void WebCompositorImpl::shutdown() |
93 { | 93 { |
94 ASSERT(s_initialized); | 94 ASSERT(s_initialized); |
95 ASSERT(!CCLayerTreeHost::anyLayerTreeHostInstanceExists()); | 95 ASSERT(!LayerTreeHost::anyLayerTreeHostInstanceExists()); |
96 | 96 |
97 if (s_implThread) { | 97 if (s_implThread) { |
98 delete s_implThread; | 98 delete s_implThread; |
99 s_implThread = 0; | 99 s_implThread = 0; |
100 } | 100 } |
101 delete s_mainThread; | 101 delete s_mainThread; |
102 s_mainThread = 0; | 102 s_mainThread = 0; |
103 CCProxy::setImplThread(0); | 103 Proxy::setImplThread(0); |
104 CCProxy::setMainThread(0); | 104 Proxy::setMainThread(0); |
105 s_initialized = false; | 105 s_initialized = false; |
106 } | 106 } |
107 | 107 |
108 } | 108 } |
OLD | NEW |