OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "android_webview/browser/hardware_renderer.h" | 5 #include "android_webview/browser/hardware_renderer.h" |
6 | 6 |
7 #include "android_webview/browser/aw_gl_surface.h" | 7 #include "android_webview/browser/aw_gl_surface.h" |
8 #include "android_webview/browser/deferred_gpu_command_service.h" | 8 #include "android_webview/browser/deferred_gpu_command_service.h" |
9 #include "android_webview/browser/parent_output_surface.h" | 9 #include "android_webview/browser/parent_output_surface.h" |
10 #include "android_webview/browser/shared_renderer_state.h" | 10 #include "android_webview/browser/shared_renderer_state.h" |
11 #include "android_webview/public/browser/draw_gl.h" | 11 #include "android_webview/public/browser/draw_gl.h" |
12 #include "base/auto_reset.h" | 12 #include "base/auto_reset.h" |
13 #include "base/debug/trace_event.h" | 13 #include "base/debug/trace_event.h" |
14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
15 #include "cc/layers/delegated_frame_provider.h" | 15 #include "cc/layers/delegated_frame_provider.h" |
16 #include "cc/layers/delegated_renderer_layer.h" | 16 #include "cc/layers/delegated_renderer_layer.h" |
17 #include "cc/layers/layer.h" | 17 #include "cc/layers/layer.h" |
18 #include "cc/output/compositor_frame.h" | 18 #include "cc/output/compositor_frame.h" |
19 #include "cc/output/output_surface.h" | 19 #include "cc/output/output_surface.h" |
| 20 #include "cc/scheduler/begin_frame_source.h" |
20 #include "cc/trees/layer_tree_host.h" | 21 #include "cc/trees/layer_tree_host.h" |
21 #include "cc/trees/layer_tree_settings.h" | 22 #include "cc/trees/layer_tree_settings.h" |
22 #include "gpu/command_buffer/client/gl_in_process_context.h" | 23 #include "gpu/command_buffer/client/gl_in_process_context.h" |
23 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 24 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
24 #include "ui/gfx/frame_time.h" | 25 #include "ui/gfx/frame_time.h" |
25 #include "ui/gfx/geometry/rect_conversions.h" | 26 #include "ui/gfx/geometry/rect_conversions.h" |
26 #include "ui/gfx/geometry/rect_f.h" | 27 #include "ui/gfx/geometry/rect_f.h" |
27 #include "ui/gfx/transform.h" | 28 #include "ui/gfx/transform.h" |
28 #include "ui/gl/gl_bindings.h" | 29 #include "ui/gl/gl_bindings.h" |
29 #include "webkit/common/gpu/context_provider_in_process.h" | 30 #include "webkit/common/gpu/context_provider_in_process.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 settings.allow_antialiasing = false; | 95 settings.allow_antialiasing = false; |
95 settings.highp_threshold_min = 2048; | 96 settings.highp_threshold_min = 2048; |
96 | 97 |
97 // Webview does not own the surface so should not clear it. | 98 // Webview does not own the surface so should not clear it. |
98 settings.should_clear_root_render_pass = false; | 99 settings.should_clear_root_render_pass = false; |
99 | 100 |
100 // TODO(enne): Update this this compositor to use a synchronous scheduler. | 101 // TODO(enne): Update this this compositor to use a synchronous scheduler. |
101 settings.single_thread_proxy_scheduler = false; | 102 settings.single_thread_proxy_scheduler = false; |
102 | 103 |
103 layer_tree_host_ = cc::LayerTreeHost::CreateSingleThreaded( | 104 layer_tree_host_ = cc::LayerTreeHost::CreateSingleThreaded( |
104 this, this, NULL, NULL, settings, NULL); | 105 this, this, nullptr, nullptr, settings, nullptr, nullptr); |
105 layer_tree_host_->SetRootLayer(root_layer_); | 106 layer_tree_host_->SetRootLayer(root_layer_); |
106 layer_tree_host_->SetLayerTreeHostClientReady(); | 107 layer_tree_host_->SetLayerTreeHostClientReady(); |
107 layer_tree_host_->set_has_transparent_background(true); | 108 layer_tree_host_->set_has_transparent_background(true); |
108 } | 109 } |
109 | 110 |
110 HardwareRenderer::~HardwareRenderer() { | 111 HardwareRenderer::~HardwareRenderer() { |
111 SetFrameData(); | 112 SetFrameData(); |
112 | 113 |
113 // Must reset everything before |resource_collection_| to ensure all | 114 // Must reset everything before |resource_collection_| to ensure all |
114 // resources are returned before resetting |resource_collection_| client. | 115 // resources are returned before resetting |resource_collection_| client. |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 } | 265 } |
265 | 266 |
266 void HardwareRenderer::UnusedResourcesAreAvailable() { | 267 void HardwareRenderer::UnusedResourcesAreAvailable() { |
267 cc::ReturnedResourceArray returned_resources; | 268 cc::ReturnedResourceArray returned_resources; |
268 resource_collection_->TakeUnusedResourcesForChildCompositor( | 269 resource_collection_->TakeUnusedResourcesForChildCompositor( |
269 &returned_resources); | 270 &returned_resources); |
270 shared_renderer_state_->InsertReturnedResourcesOnRT(returned_resources); | 271 shared_renderer_state_->InsertReturnedResourcesOnRT(returned_resources); |
271 } | 272 } |
272 | 273 |
273 } // namespace android_webview | 274 } // namespace android_webview |
OLD | NEW |