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 14 matching lines...) Expand all Loading... |
25 | 25 |
26 HardwareRenderer::HardwareRenderer(RenderThreadManager* state) | 26 HardwareRenderer::HardwareRenderer(RenderThreadManager* state) |
27 : render_thread_manager_(state), | 27 : render_thread_manager_(state), |
28 last_egl_context_(eglGetCurrentContext()), | 28 last_egl_context_(eglGetCurrentContext()), |
29 surfaces_(SurfacesInstance::GetOrCreateInstance()), | 29 surfaces_(SurfacesInstance::GetOrCreateInstance()), |
30 surface_id_allocator_(surfaces_->CreateSurfaceIdAllocator()), | 30 surface_id_allocator_(surfaces_->CreateSurfaceIdAllocator()), |
31 last_committed_output_surface_id_(0u), | 31 last_committed_output_surface_id_(0u), |
32 last_submitted_output_surface_id_(0u) { | 32 last_submitted_output_surface_id_(0u) { |
33 DCHECK(last_egl_context_); | 33 DCHECK(last_egl_context_); |
34 surfaces_->GetSurfaceManager()->RegisterSurfaceFactoryClient( | 34 surfaces_->GetSurfaceManager()->RegisterSurfaceFactoryClient( |
35 surface_id_allocator_->id_namespace(), this); | 35 surface_id_allocator_->client_id(), this); |
36 } | 36 } |
37 | 37 |
38 HardwareRenderer::~HardwareRenderer() { | 38 HardwareRenderer::~HardwareRenderer() { |
39 // Must reset everything before |surface_factory_| to ensure all | 39 // Must reset everything before |surface_factory_| to ensure all |
40 // resources are returned before resetting. | 40 // resources are returned before resetting. |
41 if (!child_id_.is_null()) | 41 if (!child_id_.is_null()) |
42 DestroySurface(); | 42 DestroySurface(); |
43 surface_factory_.reset(); | 43 surface_factory_.reset(); |
44 surfaces_->GetSurfaceManager()->UnregisterSurfaceFactoryClient( | 44 surfaces_->GetSurfaceManager()->UnregisterSurfaceFactoryClient( |
45 surface_id_allocator_->id_namespace()); | 45 surface_id_allocator_->client_id()); |
46 | 46 |
47 // Reset draw constraints. | 47 // Reset draw constraints. |
48 render_thread_manager_->PostExternalDrawConstraintsToChildCompositorOnRT( | 48 render_thread_manager_->PostExternalDrawConstraintsToChildCompositorOnRT( |
49 ParentCompositorDrawConstraints()); | 49 ParentCompositorDrawConstraints()); |
50 ReturnResourcesInChildFrame(); | 50 ReturnResourcesInChildFrame(); |
51 } | 51 } |
52 | 52 |
53 void HardwareRenderer::CommitFrame() { | 53 void HardwareRenderer::CommitFrame() { |
54 TRACE_EVENT0("android_webview", "CommitFrame"); | 54 TRACE_EVENT0("android_webview", "CommitFrame"); |
55 scroll_offset_ = render_thread_manager_->GetScrollOffsetOnRT(); | 55 scroll_offset_ = render_thread_manager_->GetScrollOffsetOnRT(); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 const cc::ReturnedResourceArray& resources, | 192 const cc::ReturnedResourceArray& resources, |
193 const CompositorID& compositor_id, | 193 const CompositorID& compositor_id, |
194 uint32_t output_surface_id) { | 194 uint32_t output_surface_id) { |
195 if (output_surface_id != last_committed_output_surface_id_) | 195 if (output_surface_id != last_committed_output_surface_id_) |
196 return; | 196 return; |
197 render_thread_manager_->InsertReturnedResourcesOnRT(resources, compositor_id, | 197 render_thread_manager_->InsertReturnedResourcesOnRT(resources, compositor_id, |
198 output_surface_id); | 198 output_surface_id); |
199 } | 199 } |
200 | 200 |
201 } // namespace android_webview | 201 } // namespace android_webview |
OLD | NEW |