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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "android_webview/browser/aw_gl_surface.h" | 9 #include "android_webview/browser/aw_gl_surface.h" |
10 #include "android_webview/browser/aw_render_thread_context_provider.h" | 10 #include "android_webview/browser/aw_render_thread_context_provider.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "ui/gfx/geometry/rect_f.h" | 31 #include "ui/gfx/geometry/rect_f.h" |
32 #include "ui/gfx/transform.h" | 32 #include "ui/gfx/transform.h" |
33 #include "ui/gl/gl_bindings.h" | 33 #include "ui/gl/gl_bindings.h" |
34 | 34 |
35 namespace android_webview { | 35 namespace android_webview { |
36 | 36 |
37 HardwareRenderer::HardwareRenderer(RenderThreadManager* state) | 37 HardwareRenderer::HardwareRenderer(RenderThreadManager* state) |
38 : render_thread_manager_(state), | 38 : render_thread_manager_(state), |
39 last_egl_context_(eglGetCurrentContext()), | 39 last_egl_context_(eglGetCurrentContext()), |
40 gl_surface_(new AwGLSurface), | 40 gl_surface_(new AwGLSurface), |
41 compositor_id_(0u), // Valid compositor id starts at 1. | |
42 last_committed_output_surface_id_(0u), | 41 last_committed_output_surface_id_(0u), |
43 last_submitted_output_surface_id_(0u), | 42 last_submitted_output_surface_id_(0u), |
44 output_surface_(NULL) { | 43 output_surface_(NULL) { |
45 DCHECK(last_egl_context_); | 44 DCHECK(last_egl_context_); |
46 | 45 |
47 cc::RendererSettings settings; | 46 cc::RendererSettings settings; |
48 | 47 |
49 // Should be kept in sync with compositor_impl_android.cc. | 48 // Should be kept in sync with compositor_impl_android.cc. |
50 settings.allow_antialiasing = false; | 49 settings.allow_antialiasing = false; |
51 settings.highp_threshold_min = 2048; | 50 settings.highp_threshold_min = 2048; |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 // compositor_id_. | 253 // compositor_id_. |
255 ReturnResourcesToCompositor(resources_to_return, | 254 ReturnResourcesToCompositor(resources_to_return, |
256 child_frame_->compositor_id, | 255 child_frame_->compositor_id, |
257 child_frame_->output_surface_id); | 256 child_frame_->output_surface_id); |
258 } | 257 } |
259 child_frame_.reset(); | 258 child_frame_.reset(); |
260 } | 259 } |
261 | 260 |
262 void HardwareRenderer::ReturnResourcesToCompositor( | 261 void HardwareRenderer::ReturnResourcesToCompositor( |
263 const cc::ReturnedResourceArray& resources, | 262 const cc::ReturnedResourceArray& resources, |
264 uint32_t compositor_id, | 263 CompositorID compositor_id, |
265 uint32_t output_surface_id) { | 264 uint32_t output_surface_id) { |
266 if (output_surface_id != last_committed_output_surface_id_) | 265 if (output_surface_id != last_committed_output_surface_id_) |
267 return; | 266 return; |
268 render_thread_manager_->InsertReturnedResourcesOnRT(resources, compositor_id, | 267 render_thread_manager_->InsertReturnedResourcesOnRT(resources, compositor_id, |
269 output_surface_id); | 268 output_surface_id); |
270 } | 269 } |
271 | 270 |
272 } // namespace android_webview | 271 } // namespace android_webview |
OLD | NEW |