| 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 "WebCompositorImpl.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 "third_party/WebKit/Source/Platform/chromium/public/Platform.h" | |
| 17 #include "webkit/glue/webthread_impl.h" | |
| 18 #include "CCThreadImpl.h" | |
| 19 | |
| 20 using namespace cc; | |
| 21 | |
| 22 namespace WebKit { | |
| 23 | |
| 24 bool WebCompositorImpl::s_initialized = false; | |
| 25 CCThread* WebCompositorImpl::s_mainThread = 0; | |
| 26 CCThread* 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 CCSettings::reset(); | |
| 42 } | |
| 43 | |
| 44 void WebCompositor::setPerTilePaintingEnabled(bool enabled) | |
| 45 { | |
| 46 ASSERT(!WebCompositorImpl::initialized()); | |
| 47 CCSettings::setPerTilePaintingEnabled(enabled); | |
| 48 } | |
| 49 | |
| 50 void WebCompositor::setPartialSwapEnabled(bool enabled) | |
| 51 { | |
| 52 ASSERT(!WebCompositorImpl::initialized()); | |
| 53 CCSettings::setPartialSwapEnabled(enabled); | |
| 54 } | |
| 55 | |
| 56 void WebCompositor::setAcceleratedAnimationEnabled(bool enabled) | |
| 57 { | |
| 58 ASSERT(!WebCompositorImpl::initialized()); | |
| 59 CCSettings::setAcceleratedAnimationEnabled(enabled); | |
| 60 } | |
| 61 | |
| 62 void WebCompositor::setPageScalePinchZoomEnabled(bool enabled) | |
| 63 { | |
| 64 ASSERT(!WebCompositorImpl::initialized()); | |
| 65 CCSettings::setPageScalePinchZoomEnabled(enabled); | |
| 66 } | |
| 67 | |
| 68 void WebCompositorImpl::initialize(WebThread* implThread) | |
| 69 { | |
| 70 ASSERT(!s_initialized); | |
| 71 s_initialized = true; | |
| 72 | |
| 73 s_mainThread = CCThreadImpl::createForCurrentThread().release(); | |
| 74 CCProxy::setMainThread(s_mainThread); | |
| 75 if (implThread) { | |
| 76 s_implThread = CCThreadImpl::createForDifferentThread(implThread).releas
e(); | |
| 77 CCProxy::setImplThread(s_implThread); | |
| 78 } else | |
| 79 CCProxy::setImplThread(0); | |
| 80 } | |
| 81 | |
| 82 bool WebCompositorImpl::isThreadingEnabled() | |
| 83 { | |
| 84 return s_implThread; | |
| 85 } | |
| 86 | |
| 87 bool WebCompositorImpl::initialized() | |
| 88 { | |
| 89 return s_initialized; | |
| 90 } | |
| 91 | |
| 92 void WebCompositorImpl::shutdown() | |
| 93 { | |
| 94 ASSERT(s_initialized); | |
| 95 ASSERT(!CCLayerTreeHost::anyLayerTreeHostInstanceExists()); | |
| 96 | |
| 97 if (s_implThread) { | |
| 98 delete s_implThread; | |
| 99 s_implThread = 0; | |
| 100 } | |
| 101 delete s_mainThread; | |
| 102 s_mainThread = 0; | |
| 103 CCProxy::setImplThread(0); | |
| 104 CCProxy::setMainThread(0); | |
| 105 s_initialized = false; | |
| 106 } | |
| 107 | |
| 108 } | |
| OLD | NEW |