| 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 #include "CCLayerTreeHost.h" | |
| 10 #include "CCProxy.h" | |
| 11 #include "CCSettings.h" | |
| 12 #include "CCThreadImpl.h" | 9 #include "CCThreadImpl.h" |
| 13 #include <public/Platform.h> | |
| 14 #include <wtf/ThreadingPrimitives.h> | |
| 15 | |
| 16 #if defined(USE_LIBCC_FOR_COMPOSITOR) | |
| 17 #ifdef LOG | 10 #ifdef LOG |
| 18 #undef LOG | 11 #undef LOG |
| 19 #endif | 12 #endif |
| 20 #include "base/message_loop_proxy.h" | 13 #include "base/message_loop_proxy.h" |
| 14 #include "cc/layer_tree_host.h" |
| 15 #include "cc/proxy.h" |
| 16 #include "cc/settings.h" |
| 17 #include "third_party/WebKit/Source/Platform/chromium/public/Platform.h" |
| 21 #include "webkit/glue/webthread_impl.h" | 18 #include "webkit/glue/webthread_impl.h" |
| 22 #endif | |
| 23 | 19 |
| 24 using namespace cc; | 20 using namespace cc; |
| 25 | 21 |
| 26 namespace WebKit { | 22 namespace WebKit { |
| 27 | 23 |
| 28 bool WebCompositorImpl::s_initialized = false; | 24 bool WebCompositorImpl::s_initialized = false; |
| 29 CCThread* WebCompositorImpl::s_mainThread = 0; | 25 CCThread* WebCompositorImpl::s_mainThread = 0; |
| 30 CCThread* WebCompositorImpl::s_implThread = 0; | 26 CCThread* WebCompositorImpl::s_implThread = 0; |
| 31 | 27 |
| 32 void WebCompositor::initialize(WebThread* implThread) | 28 void WebCompositor::initialize(WebThread* implThread) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 { | 63 { |
| 68 ASSERT(!WebCompositorImpl::initialized()); | 64 ASSERT(!WebCompositorImpl::initialized()); |
| 69 CCSettings::setPageScalePinchZoomEnabled(enabled); | 65 CCSettings::setPageScalePinchZoomEnabled(enabled); |
| 70 } | 66 } |
| 71 | 67 |
| 72 void WebCompositorImpl::initialize(WebThread* implThread) | 68 void WebCompositorImpl::initialize(WebThread* implThread) |
| 73 { | 69 { |
| 74 ASSERT(!s_initialized); | 70 ASSERT(!s_initialized); |
| 75 s_initialized = true; | 71 s_initialized = true; |
| 76 | 72 |
| 77 s_mainThread = CCThreadImpl::createForCurrentThread().leakPtr(); | 73 s_mainThread = CCThreadImpl::createForCurrentThread().release(); |
| 78 CCProxy::setMainThread(s_mainThread); | 74 CCProxy::setMainThread(s_mainThread); |
| 79 if (implThread) { | 75 if (implThread) { |
| 80 s_implThread = CCThreadImpl::createForDifferentThread(implThread).leakPt
r(); | 76 s_implThread = CCThreadImpl::createForDifferentThread(implThread).releas
e(); |
| 81 CCProxy::setImplThread(s_implThread); | 77 CCProxy::setImplThread(s_implThread); |
| 82 } else | 78 } else |
| 83 CCProxy::setImplThread(0); | 79 CCProxy::setImplThread(0); |
| 84 } | 80 } |
| 85 | 81 |
| 86 bool WebCompositorImpl::isThreadingEnabled() | 82 bool WebCompositorImpl::isThreadingEnabled() |
| 87 { | 83 { |
| 88 return s_implThread; | 84 return s_implThread; |
| 89 } | 85 } |
| 90 | 86 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 103 s_implThread = 0; | 99 s_implThread = 0; |
| 104 } | 100 } |
| 105 delete s_mainThread; | 101 delete s_mainThread; |
| 106 s_mainThread = 0; | 102 s_mainThread = 0; |
| 107 CCProxy::setImplThread(0); | 103 CCProxy::setImplThread(0); |
| 108 CCProxy::setMainThread(0); | 104 CCProxy::setMainThread(0); |
| 109 s_initialized = false; | 105 s_initialized = false; |
| 110 } | 106 } |
| 111 | 107 |
| 112 } | 108 } |
| OLD | NEW |