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

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

Issue 2477393003: Make SurfaceFactory lifetime match frame_sink_id_ registration in Android WebView (Closed)
Patch Set: Created 4 years, 1 month 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 | « android_webview/browser/hardware_renderer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/surfaces_instance.h" 5 #include "android_webview/browser/surfaces_instance.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "android_webview/browser/aw_gl_surface.h" 10 #include "android_webview/browser/aw_gl_surface.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 // Should be kept in sync with compositor_impl_android.cc. 45 // Should be kept in sync with compositor_impl_android.cc.
46 settings.allow_antialiasing = false; 46 settings.allow_antialiasing = false;
47 settings.highp_threshold_min = 2048; 47 settings.highp_threshold_min = 2048;
48 48
49 // Webview does not own the surface so should not clear it. 49 // Webview does not own the surface so should not clear it.
50 settings.should_clear_root_render_pass = false; 50 settings.should_clear_root_render_pass = false;
51 51
52 surface_manager_.reset(new cc::SurfaceManager); 52 surface_manager_.reset(new cc::SurfaceManager);
53 surface_id_allocator_.reset(new cc::SurfaceIdAllocator()); 53 surface_id_allocator_.reset(new cc::SurfaceIdAllocator());
54 surface_manager_->RegisterFrameSinkId(frame_sink_id_); 54 surface_manager_->RegisterFrameSinkId(frame_sink_id_);
55 surface_factory_.reset(
56 new cc::SurfaceFactory(frame_sink_id_, surface_manager_.get(), this));
55 57
56 std::unique_ptr<cc::BeginFrameSource> begin_frame_source( 58 std::unique_ptr<cc::BeginFrameSource> begin_frame_source(
57 new cc::StubBeginFrameSource); 59 new cc::StubBeginFrameSource);
58 std::unique_ptr<cc::TextureMailboxDeleter> texture_mailbox_deleter( 60 std::unique_ptr<cc::TextureMailboxDeleter> texture_mailbox_deleter(
59 new cc::TextureMailboxDeleter(nullptr)); 61 new cc::TextureMailboxDeleter(nullptr));
60 std::unique_ptr<ParentOutputSurface> output_surface_holder( 62 std::unique_ptr<ParentOutputSurface> output_surface_holder(
61 new ParentOutputSurface(AwRenderThreadContextProvider::Create( 63 new ParentOutputSurface(AwRenderThreadContextProvider::Create(
62 make_scoped_refptr(new AwGLSurface), 64 make_scoped_refptr(new AwGLSurface),
63 DeferredGpuCommandService::GetInstance()))); 65 DeferredGpuCommandService::GetInstance())));
64 output_surface_ = output_surface_holder.get(); 66 output_surface_ = output_surface_holder.get();
65 std::unique_ptr<cc::DisplayScheduler> scheduler(new cc::DisplayScheduler( 67 std::unique_ptr<cc::DisplayScheduler> scheduler(new cc::DisplayScheduler(
66 begin_frame_source.get(), nullptr, 68 begin_frame_source.get(), nullptr,
67 output_surface_holder->capabilities().max_frames_pending)); 69 output_surface_holder->capabilities().max_frames_pending));
68 display_.reset(new cc::Display( 70 display_.reset(new cc::Display(
69 nullptr /* shared_bitmap_manager */, 71 nullptr /* shared_bitmap_manager */,
70 nullptr /* gpu_memory_buffer_manager */, settings, 72 nullptr /* gpu_memory_buffer_manager */, settings,
71 std::move(begin_frame_source), std::move(output_surface_holder), 73 std::move(begin_frame_source), std::move(output_surface_holder),
72 std::move(scheduler), std::move(texture_mailbox_deleter))); 74 std::move(scheduler), std::move(texture_mailbox_deleter)));
73 display_->Initialize(this, surface_manager_.get(), frame_sink_id_); 75 display_->Initialize(this, surface_manager_.get(), frame_sink_id_);
74 display_->SetVisible(true); 76 display_->SetVisible(true);
75 77
76 surface_factory_.reset(
77 new cc::SurfaceFactory(frame_sink_id_, surface_manager_.get(), this));
78
79 DCHECK(!g_surfaces_instance); 78 DCHECK(!g_surfaces_instance);
80 g_surfaces_instance = this; 79 g_surfaces_instance = this;
81 80
82 } 81 }
83 82
84 SurfacesInstance::~SurfacesInstance() { 83 SurfacesInstance::~SurfacesInstance() {
85 DCHECK_EQ(g_surfaces_instance, this); 84 DCHECK_EQ(g_surfaces_instance, this);
86 g_surfaces_instance = nullptr; 85 g_surfaces_instance = nullptr;
87 86
88 DCHECK(child_ids_.empty()); 87 DCHECK(child_ids_.empty());
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 CHECK(resources.empty()); 177 CHECK(resources.empty());
179 } 178 }
180 179
181 void SurfacesInstance::SetBeginFrameSource( 180 void SurfacesInstance::SetBeginFrameSource(
182 cc::BeginFrameSource* begin_frame_source) { 181 cc::BeginFrameSource* begin_frame_source) {
183 // Parent compsitor calls DrawAndSwap directly and doesn't use 182 // Parent compsitor calls DrawAndSwap directly and doesn't use
184 // BeginFrameSource. 183 // BeginFrameSource.
185 } 184 }
186 185
187 } // namespace android_webview 186 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/browser/hardware_renderer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698