| 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" |
| 11 #include "android_webview/browser/child_frame.h" | 11 #include "android_webview/browser/child_frame.h" |
| 12 #include "android_webview/browser/parent_compositor_draw_constraints.h" | 12 #include "android_webview/browser/parent_compositor_draw_constraints.h" |
| 13 #include "android_webview/browser/render_thread_manager.h" | 13 #include "android_webview/browser/render_thread_manager.h" |
| 14 #include "android_webview/browser/surfaces_instance.h" | 14 #include "android_webview/browser/surfaces_instance.h" |
| 15 #include "android_webview/public/browser/draw_gl.h" | 15 #include "android_webview/public/browser/draw_gl.h" |
| 16 #include "base/trace_event/trace_event.h" | 16 #include "base/trace_event/trace_event.h" |
| 17 #include "cc/output/compositor_frame.h" | 17 #include "cc/output/compositor_frame.h" |
| 18 #include "cc/surfaces/surface_factory.h" | 18 #include "cc/surfaces/surface_factory.h" |
| 19 #include "cc/surfaces/surface_id_allocator.h" | 19 #include "cc/surfaces/surface_id_allocator.h" |
| 20 #include "cc/surfaces/surface_manager.h" | 20 #include "cc/surfaces/surface_manager.h" |
| 21 #include "ui/gfx/transform.h" | 21 #include "ui/gfx/transform.h" |
| 22 #include "ui/gl/gl_bindings.h" | 22 #include "ui/gl/gl_bindings.h" |
| 23 | 23 |
| 24 namespace android_webview { | 24 namespace android_webview { |
| 25 | 25 |
| 26 HardwareRenderer::HardwareRenderer(RenderThreadManager* state) | 26 HardwareRenderer::HardwareRenderer(RenderThreadManager* state, |
| 27 int framebuffer_binding_ext) |
| 27 : render_thread_manager_(state), | 28 : render_thread_manager_(state), |
| 28 last_egl_context_(eglGetCurrentContext()), | 29 last_egl_context_(eglGetCurrentContext()), |
| 29 surfaces_(SurfacesInstance::GetOrCreateInstance()), | 30 surfaces_(SurfacesInstance::GetOrCreateInstance(framebuffer_binding_ext)), |
| 30 surface_id_allocator_(surfaces_->CreateSurfaceIdAllocator()), | 31 surface_id_allocator_(surfaces_->CreateSurfaceIdAllocator()), |
| 31 last_committed_output_surface_id_(0u), | 32 last_committed_output_surface_id_(0u), |
| 32 last_submitted_output_surface_id_(0u) { | 33 last_submitted_output_surface_id_(0u) { |
| 33 DCHECK(last_egl_context_); | 34 DCHECK(last_egl_context_); |
| 34 surfaces_->GetSurfaceManager()->RegisterSurfaceFactoryClient( | 35 surfaces_->GetSurfaceManager()->RegisterSurfaceFactoryClient( |
| 35 surface_id_allocator_->id_namespace(), this); | 36 surface_id_allocator_->id_namespace(), this); |
| 36 } | 37 } |
| 37 | 38 |
| 38 HardwareRenderer::~HardwareRenderer() { | 39 HardwareRenderer::~HardwareRenderer() { |
| 39 // Must reset everything before |surface_factory_| to ensure all | 40 // Must reset everything before |surface_factory_| to ensure all |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 const cc::ReturnedResourceArray& resources, | 193 const cc::ReturnedResourceArray& resources, |
| 193 const CompositorID& compositor_id, | 194 const CompositorID& compositor_id, |
| 194 uint32_t output_surface_id) { | 195 uint32_t output_surface_id) { |
| 195 if (output_surface_id != last_committed_output_surface_id_) | 196 if (output_surface_id != last_committed_output_surface_id_) |
| 196 return; | 197 return; |
| 197 render_thread_manager_->InsertReturnedResourcesOnRT(resources, compositor_id, | 198 render_thread_manager_->InsertReturnedResourcesOnRT(resources, compositor_id, |
| 198 output_surface_id); | 199 output_surface_id); |
| 199 } | 200 } |
| 200 | 201 |
| 201 } // namespace android_webview | 202 } // namespace android_webview |
| OLD | NEW |