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

Side by Side Diff: ui/compositor/test/in_process_context_factory.cc

Issue 2656893003: Let DelegateFrameHost in Mac and Android use correct FrameSinkId during creation (Closed)
Patch Set: more comments Created 3 years, 10 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 | « ui/compositor/test/in_process_context_factory.h ('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 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 "ui/compositor/test/in_process_context_factory.h" 5 #include "ui/compositor/test/in_process_context_factory.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 120
121 struct InProcessContextFactory::PerCompositorData { 121 struct InProcessContextFactory::PerCompositorData {
122 gpu::SurfaceHandle surface_handle = gpu::kNullSurfaceHandle; 122 gpu::SurfaceHandle surface_handle = gpu::kNullSurfaceHandle;
123 std::unique_ptr<cc::BeginFrameSource> begin_frame_source; 123 std::unique_ptr<cc::BeginFrameSource> begin_frame_source;
124 std::unique_ptr<cc::Display> display; 124 std::unique_ptr<cc::Display> display;
125 }; 125 };
126 126
127 InProcessContextFactory::InProcessContextFactory( 127 InProcessContextFactory::InProcessContextFactory(
128 bool context_factory_for_test, 128 bool context_factory_for_test,
129 cc::SurfaceManager* surface_manager) 129 cc::SurfaceManager* surface_manager)
130 : next_surface_client_id_(1u), 130 : next_surface_sink_id_(1u),
131 use_test_surface_(true), 131 use_test_surface_(true),
132 context_factory_for_test_(context_factory_for_test), 132 context_factory_for_test_(context_factory_for_test),
133 surface_manager_(surface_manager) { 133 surface_manager_(surface_manager) {
134 DCHECK(surface_manager); 134 DCHECK(surface_manager);
135 DCHECK_NE(gl::GetGLImplementation(), gl::kGLImplementationNone) 135 DCHECK_NE(gl::GetGLImplementation(), gl::kGLImplementationNone)
136 << "If running tests, ensure that main() is calling " 136 << "If running tests, ensure that main() is calling "
137 << "gl::GLSurfaceTestSupport::InitializeOneOff()"; 137 << "gl::GLSurfaceTestSupport::InitializeOneOff()";
138 } 138 }
139 139
140 InProcessContextFactory::~InProcessContextFactory() { 140 InProcessContextFactory::~InProcessContextFactory() {
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 gpu::GpuMemoryBufferManager* 274 gpu::GpuMemoryBufferManager*
275 InProcessContextFactory::GetGpuMemoryBufferManager() { 275 InProcessContextFactory::GetGpuMemoryBufferManager() {
276 return &gpu_memory_buffer_manager_; 276 return &gpu_memory_buffer_manager_;
277 } 277 }
278 278
279 cc::TaskGraphRunner* InProcessContextFactory::GetTaskGraphRunner() { 279 cc::TaskGraphRunner* InProcessContextFactory::GetTaskGraphRunner() {
280 return &task_graph_runner_; 280 return &task_graph_runner_;
281 } 281 }
282 282
283 cc::FrameSinkId InProcessContextFactory::AllocateFrameSinkId() { 283 cc::FrameSinkId InProcessContextFactory::AllocateFrameSinkId() {
284 return cc::FrameSinkId(next_surface_client_id_++, 0); 284 // The FrameSinkId generated here must be unique with
285 // RenderWidgetHostViewAura's
286 // and RenderWidgetHostViewMac's FrameSinkId allocation.
287 // TODO(crbug.com/685777): Centralize allocation in one place for easier
288 // maintenance.
289 return cc::FrameSinkId(0, next_surface_sink_id_++);
285 } 290 }
286 291
287 cc::SurfaceManager* InProcessContextFactory::GetSurfaceManager() { 292 cc::SurfaceManager* InProcessContextFactory::GetSurfaceManager() {
288 return surface_manager_; 293 return surface_manager_;
289 } 294 }
290 295
291 void InProcessContextFactory::SetDisplayVisible(ui::Compositor* compositor, 296 void InProcessContextFactory::SetDisplayVisible(ui::Compositor* compositor,
292 bool visible) { 297 bool visible) {
293 if (!per_compositor_data_.count(compositor)) 298 if (!per_compositor_data_.count(compositor))
294 return; 299 return;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 data->surface_handle = tracker->AddSurfaceForNativeWidget(widget); 332 data->surface_handle = tracker->AddSurfaceForNativeWidget(widget);
328 #endif 333 #endif
329 } 334 }
330 335
331 PerCompositorData* return_ptr = data.get(); 336 PerCompositorData* return_ptr = data.get();
332 per_compositor_data_[compositor] = std::move(data); 337 per_compositor_data_[compositor] = std::move(data);
333 return return_ptr; 338 return return_ptr;
334 } 339 }
335 340
336 } // namespace ui 341 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/test/in_process_context_factory.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698