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

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

Issue 2136413002: Update Surface ID Terminology (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed webkit_unit_tests Created 4 years, 5 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
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 21 matching lines...) Expand all
32 } // namespace 32 } // namespace
33 33
34 // static 34 // static
35 scoped_refptr<SurfacesInstance> SurfacesInstance::GetOrCreateInstance() { 35 scoped_refptr<SurfacesInstance> SurfacesInstance::GetOrCreateInstance() {
36 if (g_surfaces_instance) 36 if (g_surfaces_instance)
37 return make_scoped_refptr(g_surfaces_instance); 37 return make_scoped_refptr(g_surfaces_instance);
38 return make_scoped_refptr(new SurfacesInstance); 38 return make_scoped_refptr(new SurfacesInstance);
39 } 39 }
40 40
41 SurfacesInstance::SurfacesInstance() 41 SurfacesInstance::SurfacesInstance()
42 : next_surface_id_namespace_(1u), 42 : next_surface_client_id_(1u), gl_surface_(new AwGLSurface) {
43 gl_surface_(new AwGLSurface) {
44 cc::RendererSettings settings; 43 cc::RendererSettings settings;
45 44
46 // Should be kept in sync with compositor_impl_android.cc. 45 // Should be kept in sync with compositor_impl_android.cc.
47 settings.allow_antialiasing = false; 46 settings.allow_antialiasing = false;
48 settings.highp_threshold_min = 2048; 47 settings.highp_threshold_min = 2048;
49 48
50 // Webview does not own the surface so should not clear it. 49 // Webview does not own the surface so should not clear it.
51 settings.should_clear_root_render_pass = false; 50 settings.should_clear_root_render_pass = false;
52 51
53 surface_manager_.reset(new cc::SurfaceManager); 52 surface_manager_.reset(new cc::SurfaceManager);
54 surface_id_allocator_.reset( 53 surface_id_allocator_.reset(
55 new cc::SurfaceIdAllocator(next_surface_id_namespace_++)); 54 new cc::SurfaceIdAllocator(next_surface_client_id_++));
56 surface_id_allocator_->RegisterSurfaceIdNamespace(surface_manager_.get()); 55 surface_id_allocator_->RegisterSurfaceClientId(surface_manager_.get());
57 56
58 std::unique_ptr<cc::BeginFrameSource> begin_frame_source( 57 std::unique_ptr<cc::BeginFrameSource> begin_frame_source(
59 new cc::StubBeginFrameSource); 58 new cc::StubBeginFrameSource);
60 std::unique_ptr<cc::TextureMailboxDeleter> texture_mailbox_deleter( 59 std::unique_ptr<cc::TextureMailboxDeleter> texture_mailbox_deleter(
61 new cc::TextureMailboxDeleter(nullptr)); 60 new cc::TextureMailboxDeleter(nullptr));
62 std::unique_ptr<ParentOutputSurface> output_surface_holder( 61 std::unique_ptr<ParentOutputSurface> output_surface_holder(
63 new ParentOutputSurface(AwRenderThreadContextProvider::Create( 62 new ParentOutputSurface(AwRenderThreadContextProvider::Create(
64 gl_surface_, DeferredGpuCommandService::GetInstance()))); 63 gl_surface_, DeferredGpuCommandService::GetInstance())));
65 output_surface_ = output_surface_holder.get(); 64 output_surface_ = output_surface_holder.get();
66 std::unique_ptr<cc::DisplayScheduler> scheduler(new cc::DisplayScheduler( 65 std::unique_ptr<cc::DisplayScheduler> scheduler(new cc::DisplayScheduler(
67 begin_frame_source.get(), nullptr, 66 begin_frame_source.get(), nullptr,
68 output_surface_holder->capabilities().max_frames_pending)); 67 output_surface_holder->capabilities().max_frames_pending));
69 display_.reset(new cc::Display( 68 display_.reset(new cc::Display(
70 surface_manager_.get(), nullptr /* shared_bitmap_manager */, 69 surface_manager_.get(), nullptr /* shared_bitmap_manager */,
71 nullptr /* gpu_memory_buffer_manager */, settings, 70 nullptr /* gpu_memory_buffer_manager */, settings,
72 surface_id_allocator_->id_namespace(), std::move(begin_frame_source), 71 surface_id_allocator_->client_id(), std::move(begin_frame_source),
73 std::move(output_surface_holder), std::move(scheduler), 72 std::move(output_surface_holder), std::move(scheduler),
74 std::move(texture_mailbox_deleter))); 73 std::move(texture_mailbox_deleter)));
75 display_->Initialize(this); 74 display_->Initialize(this);
76 75
77 surface_factory_.reset(new cc::SurfaceFactory(surface_manager_.get(), this)); 76 surface_factory_.reset(new cc::SurfaceFactory(surface_manager_.get(), this));
78 77
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());
89 if (!root_id_.is_null()) 88 if (!root_id_.is_null())
90 surface_factory_->Destroy(root_id_); 89 surface_factory_->Destroy(root_id_);
91 } 90 }
92 91
93 std::unique_ptr<cc::SurfaceIdAllocator> 92 std::unique_ptr<cc::SurfaceIdAllocator>
94 SurfacesInstance::CreateSurfaceIdAllocator() { 93 SurfacesInstance::CreateSurfaceIdAllocator() {
95 std::unique_ptr<cc::SurfaceIdAllocator> allocator = base::WrapUnique( 94 std::unique_ptr<cc::SurfaceIdAllocator> allocator =
96 new cc::SurfaceIdAllocator(next_surface_id_namespace_++)); 95 base::WrapUnique(new cc::SurfaceIdAllocator(next_surface_client_id_++));
97 allocator->RegisterSurfaceIdNamespace(surface_manager_.get()); 96 allocator->RegisterSurfaceClientId(surface_manager_.get());
98 return allocator; 97 return allocator;
99 } 98 }
100 99
101 cc::SurfaceManager* SurfacesInstance::GetSurfaceManager() { 100 cc::SurfaceManager* SurfacesInstance::GetSurfaceManager() {
102 return surface_manager_.get(); 101 return surface_manager_.get();
103 } 102 }
104 103
105 void SurfacesInstance::SetBackingFrameBufferObject( 104 void SurfacesInstance::SetBackingFrameBufferObject(
106 int framebuffer_binding_ext) { 105 int framebuffer_binding_ext) {
107 gl_surface_->SetBackingFrameBufferObject(framebuffer_binding_ext); 106 gl_surface_->SetBackingFrameBufferObject(framebuffer_binding_ext);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 CHECK(resources.empty()); 185 CHECK(resources.empty());
187 } 186 }
188 187
189 void SurfacesInstance::SetBeginFrameSource( 188 void SurfacesInstance::SetBeginFrameSource(
190 cc::BeginFrameSource* begin_frame_source) { 189 cc::BeginFrameSource* begin_frame_source) {
191 // Parent compsitor calls DrawAndSwap directly and doesn't use 190 // Parent compsitor calls DrawAndSwap directly and doesn't use
192 // BeginFrameSource. 191 // BeginFrameSource.
193 } 192 }
194 193
195 } // namespace android_webview 194 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698