Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(524)

Side by Side Diff: android_webview/browser/hardware_renderer.cc

Issue 2382873002: Replace usage of SurfaceId's client_id with FrameSinkId (Closed)
Patch Set: Rebased Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | android_webview/browser/surfaces_instance.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10 matching lines...) Expand all
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 : 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_( 30 surface_id_allocator_(
31 new cc::SurfaceIdAllocator(surfaces_->AllocateSurfaceClientId())), 31 new cc::SurfaceIdAllocator(surfaces_->AllocateFrameSinkId())),
32 last_committed_compositor_frame_sink_id_(0u), 32 last_committed_compositor_frame_sink_id_(0u),
33 last_submitted_compositor_frame_sink_id_(0u) { 33 last_submitted_compositor_frame_sink_id_(0u) {
34 DCHECK(last_egl_context_); 34 DCHECK(last_egl_context_);
35 surfaces_->GetSurfaceManager()->RegisterSurfaceClientId( 35 surfaces_->GetSurfaceManager()->RegisterFrameSinkId(
36 surface_id_allocator_->client_id()); 36 surface_id_allocator_->frame_sink_id());
37 surfaces_->GetSurfaceManager()->RegisterSurfaceFactoryClient( 37 surfaces_->GetSurfaceManager()->RegisterSurfaceFactoryClient(
38 surface_id_allocator_->client_id(), this); 38 surface_id_allocator_->frame_sink_id(), this);
39 } 39 }
40 40
41 HardwareRenderer::~HardwareRenderer() { 41 HardwareRenderer::~HardwareRenderer() {
42 // Must reset everything before |surface_factory_| to ensure all 42 // Must reset everything before |surface_factory_| to ensure all
43 // resources are returned before resetting. 43 // resources are returned before resetting.
44 if (!child_id_.is_null()) 44 if (!child_id_.is_null())
45 DestroySurface(); 45 DestroySurface();
46 surface_factory_.reset(); 46 surface_factory_.reset();
47 surfaces_->GetSurfaceManager()->UnregisterSurfaceFactoryClient( 47 surfaces_->GetSurfaceManager()->UnregisterSurfaceFactoryClient(
48 surface_id_allocator_->client_id()); 48 surface_id_allocator_->frame_sink_id());
49 surfaces_->GetSurfaceManager()->InvalidateSurfaceClientId( 49 surfaces_->GetSurfaceManager()->InvalidateFrameSinkId(
50 surface_id_allocator_->client_id()); 50 surface_id_allocator_->frame_sink_id());
51 51
52 // Reset draw constraints. 52 // Reset draw constraints.
53 render_thread_manager_->PostExternalDrawConstraintsToChildCompositorOnRT( 53 render_thread_manager_->PostExternalDrawConstraintsToChildCompositorOnRT(
54 ParentCompositorDrawConstraints()); 54 ParentCompositorDrawConstraints());
55 ReturnResourcesInChildFrame(); 55 ReturnResourcesInChildFrame();
56 } 56 }
57 57
58 void HardwareRenderer::CommitFrame() { 58 void HardwareRenderer::CommitFrame() {
59 TRACE_EVENT0("android_webview", "CommitFrame"); 59 TRACE_EVENT0("android_webview", "CommitFrame");
60 scroll_offset_ = render_thread_manager_->GetScrollOffsetOnRT(); 60 scroll_offset_ = render_thread_manager_->GetScrollOffsetOnRT();
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 const cc::ReturnedResourceArray& resources, 193 const cc::ReturnedResourceArray& resources,
194 const CompositorID& compositor_id, 194 const CompositorID& compositor_id,
195 uint32_t compositor_frame_sink_id) { 195 uint32_t compositor_frame_sink_id) {
196 if (compositor_frame_sink_id != last_committed_compositor_frame_sink_id_) 196 if (compositor_frame_sink_id != last_committed_compositor_frame_sink_id_)
197 return; 197 return;
198 render_thread_manager_->InsertReturnedResourcesOnRT(resources, compositor_id, 198 render_thread_manager_->InsertReturnedResourcesOnRT(resources, compositor_id,
199 compositor_frame_sink_id); 199 compositor_frame_sink_id);
200 } 200 }
201 201
202 } // namespace android_webview 202 } // namespace android_webview
OLDNEW
« no previous file with comments | « no previous file | android_webview/browser/surfaces_instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698