| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "webkit/compositor_bindings/web_layer_tree_view_impl_for_testing.h" | 5 #include "webkit/compositor_bindings/web_layer_tree_view_impl_for_testing.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
| 9 #include "base/synchronization/lock.h" | 9 #include "base/synchronization/lock.h" |
| 10 #include "cc/context_provider.h" | 10 #include "cc/context_provider.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "third_party/WebKit/Source/Platform/chromium/public/WebSharedGraphicsCo
ntext3D.h" | 26 #include "third_party/WebKit/Source/Platform/chromium/public/WebSharedGraphicsCo
ntext3D.h" |
| 27 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" | 27 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" |
| 28 #include "webkit/compositor_bindings/web_compositor_support_impl.h" | 28 #include "webkit/compositor_bindings/web_compositor_support_impl.h" |
| 29 #include "webkit/compositor_bindings/web_compositor_support_software_output_devi
ce.h" | 29 #include "webkit/compositor_bindings/web_compositor_support_software_output_devi
ce.h" |
| 30 #include "webkit/compositor_bindings/web_layer_impl.h" | 30 #include "webkit/compositor_bindings/web_layer_impl.h" |
| 31 #include "webkit/compositor_bindings/web_rendering_stats_impl.h" | 31 #include "webkit/compositor_bindings/web_rendering_stats_impl.h" |
| 32 #include "webkit/compositor_bindings/web_to_ccinput_handler_adapter.h" | 32 #include "webkit/compositor_bindings/web_to_ccinput_handler_adapter.h" |
| 33 #include "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" | 33 #include "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" |
| 34 | 34 |
| 35 namespace WebKit { | 35 namespace WebKit { |
| 36 WebLayerTreeViewImplForTesting::WebLayerTreeViewImplForTesting( |
| 37 RenderingType type, |
| 38 webkit_support::DRTLayerTreeViewClient* client) |
| 39 : type_(type), |
| 40 drt_client_(client), |
| 41 client_(NULL) {} |
| 36 | 42 |
| 37 WebLayerTreeViewImplForTesting::WebLayerTreeViewImplForTesting( | 43 WebLayerTreeViewImplForTesting::WebLayerTreeViewImplForTesting( |
| 38 RenderingType type, | 44 RenderingType type, |
| 39 WebKit::WebLayerTreeViewClient* client) | 45 WebKit::WebLayerTreeViewClient* client) |
| 40 : type_(type), client_(client) {} | 46 : type_(type), |
| 47 drt_client_(NULL), |
| 48 client_(client) {} |
| 41 | 49 |
| 42 WebLayerTreeViewImplForTesting::~WebLayerTreeViewImplForTesting() {} | 50 WebLayerTreeViewImplForTesting::~WebLayerTreeViewImplForTesting() {} |
| 43 | 51 |
| 44 bool WebLayerTreeViewImplForTesting::initialize( | 52 bool WebLayerTreeViewImplForTesting::initialize( |
| 45 scoped_ptr<cc::Thread> compositor_thread) { | 53 scoped_ptr<cc::Thread> compositor_thread) { |
| 46 cc::LayerTreeSettings settings; | 54 cc::LayerTreeSettings settings; |
| 47 // Accelerated animations are disabled for layout tests, but enabled for unit | 55 // Accelerated animations are disabled for layout tests, but enabled for unit |
| 48 // tests. | 56 // tests. |
| 49 settings.acceleratedAnimationEnabled = type_ == FAKE_CONTEXT; | 57 settings.acceleratedAnimationEnabled = type_ == FAKE_CONTEXT; |
| 50 layer_tree_host_ = | 58 layer_tree_host_ = |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 } | 164 } |
| 157 | 165 |
| 158 void WebLayerTreeViewImplForTesting::renderingStats(WebRenderingStats&) const {} | 166 void WebLayerTreeViewImplForTesting::renderingStats(WebRenderingStats&) const {} |
| 159 | 167 |
| 160 void WebLayerTreeViewImplForTesting::willBeginFrame() {} | 168 void WebLayerTreeViewImplForTesting::willBeginFrame() {} |
| 161 | 169 |
| 162 void WebLayerTreeViewImplForTesting::didBeginFrame() {} | 170 void WebLayerTreeViewImplForTesting::didBeginFrame() {} |
| 163 | 171 |
| 164 void WebLayerTreeViewImplForTesting::animate( | 172 void WebLayerTreeViewImplForTesting::animate( |
| 165 double monotonic_frame_begin_time) { | 173 double monotonic_frame_begin_time) { |
| 166 if (client_) | |
| 167 client_->updateAnimations(monotonic_frame_begin_time); | |
| 168 } | 174 } |
| 169 | 175 |
| 170 void WebLayerTreeViewImplForTesting::layout() { | 176 void WebLayerTreeViewImplForTesting::layout() { |
| 177 if (drt_client_) |
| 178 drt_client_->Layout(); |
| 171 if (client_) | 179 if (client_) |
| 172 client_->layout(); | 180 client_->layout(); |
| 173 } | 181 } |
| 174 | 182 |
| 175 void WebLayerTreeViewImplForTesting::applyScrollAndScale( | 183 void WebLayerTreeViewImplForTesting::applyScrollAndScale( |
| 176 gfx::Vector2d scroll_delta, | 184 gfx::Vector2d scroll_delta, |
| 177 float page_scale) {} | 185 float page_scale) {} |
| 178 | 186 |
| 179 scoped_ptr<cc::OutputSurface> | 187 scoped_ptr<cc::OutputSurface> |
| 180 WebLayerTreeViewImplForTesting::createOutputSurface() { | 188 WebLayerTreeViewImplForTesting::createOutputSurface() { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 | 222 |
| 215 void WebLayerTreeViewImplForTesting::willCommit() {} | 223 void WebLayerTreeViewImplForTesting::willCommit() {} |
| 216 | 224 |
| 217 void WebLayerTreeViewImplForTesting::didCommit() {} | 225 void WebLayerTreeViewImplForTesting::didCommit() {} |
| 218 | 226 |
| 219 void WebLayerTreeViewImplForTesting::didCommitAndDrawFrame() {} | 227 void WebLayerTreeViewImplForTesting::didCommitAndDrawFrame() {} |
| 220 | 228 |
| 221 void WebLayerTreeViewImplForTesting::didCompleteSwapBuffers() {} | 229 void WebLayerTreeViewImplForTesting::didCompleteSwapBuffers() {} |
| 222 | 230 |
| 223 void WebLayerTreeViewImplForTesting::scheduleComposite() { | 231 void WebLayerTreeViewImplForTesting::scheduleComposite() { |
| 232 if (drt_client_) |
| 233 drt_client_->ScheduleComposite(); |
| 224 if (client_) | 234 if (client_) |
| 225 client_->scheduleComposite(); | 235 client_->scheduleComposite(); |
| 226 } | 236 } |
| 227 | 237 |
| 228 class WebLayerTreeViewImplForTesting::MainThreadContextProvider : | 238 class WebLayerTreeViewImplForTesting::MainThreadContextProvider : |
| 229 public cc::ContextProvider { | 239 public cc::ContextProvider { |
| 230 public: | 240 public: |
| 231 virtual bool InitializeOnMainThread() OVERRIDE { return true; } | 241 virtual bool InitializeOnMainThread() OVERRIDE { return true; } |
| 232 virtual bool BindToCurrentThread() OVERRIDE { return true; } | 242 virtual bool BindToCurrentThread() OVERRIDE { return true; } |
| 233 | 243 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 | 302 |
| 293 scoped_refptr<cc::ContextProvider> | 303 scoped_refptr<cc::ContextProvider> |
| 294 WebLayerTreeViewImplForTesting::OffscreenContextProviderForCompositorThread() { | 304 WebLayerTreeViewImplForTesting::OffscreenContextProviderForCompositorThread() { |
| 295 if (!contexts_compositor_thread_ || | 305 if (!contexts_compositor_thread_ || |
| 296 contexts_compositor_thread_->DestroyedOnMainThread()) | 306 contexts_compositor_thread_->DestroyedOnMainThread()) |
| 297 contexts_compositor_thread_ = new CompositorThreadContextProvider; | 307 contexts_compositor_thread_ = new CompositorThreadContextProvider; |
| 298 return contexts_compositor_thread_; | 308 return contexts_compositor_thread_; |
| 299 } | 309 } |
| 300 | 310 |
| 301 } // namespace WebKit | 311 } // namespace WebKit |
| OLD | NEW |