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

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

Issue 2136413002: Update Surface ID Terminology (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix 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 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 base::WeakPtrFactory<DirectOutputSurface> weak_ptr_factory_; 96 base::WeakPtrFactory<DirectOutputSurface> weak_ptr_factory_;
97 97
98 DISALLOW_COPY_AND_ASSIGN(DirectOutputSurface); 98 DISALLOW_COPY_AND_ASSIGN(DirectOutputSurface);
99 }; 99 };
100 100
101 } // namespace 101 } // namespace
102 102
103 InProcessContextFactory::InProcessContextFactory( 103 InProcessContextFactory::InProcessContextFactory(
104 bool context_factory_for_test, 104 bool context_factory_for_test,
105 cc::SurfaceManager* surface_manager) 105 cc::SurfaceManager* surface_manager)
106 : next_surface_id_namespace_(1u), 106 : next_surface_client_id_(1u),
107 use_test_surface_(true), 107 use_test_surface_(true),
108 context_factory_for_test_(context_factory_for_test), 108 context_factory_for_test_(context_factory_for_test),
109 surface_manager_(surface_manager) { 109 surface_manager_(surface_manager) {
110 DCHECK_NE(gl::GetGLImplementation(), gl::kGLImplementationNone) 110 DCHECK_NE(gl::GetGLImplementation(), gl::kGLImplementationNone)
111 << "If running tests, ensure that main() is calling " 111 << "If running tests, ensure that main() is calling "
112 << "gl::GLSurfaceTestSupport::InitializeOneOff()"; 112 << "gl::GLSurfaceTestSupport::InitializeOneOff()";
113 } 113 }
114 114
115 InProcessContextFactory::~InProcessContextFactory() { 115 InProcessContextFactory::~InProcessContextFactory() {
116 DCHECK(per_compositor_data_.empty()); 116 DCHECK(per_compositor_data_.empty());
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 std::unique_ptr<cc::DelayBasedBeginFrameSource> begin_frame_source( 172 std::unique_ptr<cc::DelayBasedBeginFrameSource> begin_frame_source(
173 new cc::DelayBasedBeginFrameSource( 173 new cc::DelayBasedBeginFrameSource(
174 base::MakeUnique<cc::DelayBasedTimeSource>( 174 base::MakeUnique<cc::DelayBasedTimeSource>(
175 compositor->task_runner().get()))); 175 compositor->task_runner().get())));
176 std::unique_ptr<cc::DisplayScheduler> scheduler(new cc::DisplayScheduler( 176 std::unique_ptr<cc::DisplayScheduler> scheduler(new cc::DisplayScheduler(
177 begin_frame_source.get(), compositor->task_runner().get(), 177 begin_frame_source.get(), compositor->task_runner().get(),
178 display_output_surface->capabilities().max_frames_pending)); 178 display_output_surface->capabilities().max_frames_pending));
179 per_compositor_data_[compositor.get()] = base::MakeUnique<cc::Display>( 179 per_compositor_data_[compositor.get()] = base::MakeUnique<cc::Display>(
180 surface_manager_, GetSharedBitmapManager(), GetGpuMemoryBufferManager(), 180 surface_manager_, GetSharedBitmapManager(), GetGpuMemoryBufferManager(),
181 compositor->GetRendererSettings(), 181 compositor->GetRendererSettings(),
182 compositor->surface_id_allocator()->id_namespace(), 182 compositor->surface_id_allocator()->client_id(),
183 std::move(begin_frame_source), std::move(display_output_surface), 183 std::move(begin_frame_source), std::move(display_output_surface),
184 std::move(scheduler), base::MakeUnique<cc::TextureMailboxDeleter>( 184 std::move(scheduler), base::MakeUnique<cc::TextureMailboxDeleter>(
185 compositor->task_runner().get())); 185 compositor->task_runner().get()));
186 186
187 auto* display = per_compositor_data_[compositor.get()].get(); 187 auto* display = per_compositor_data_[compositor.get()].get();
188 std::unique_ptr<cc::SurfaceDisplayOutputSurface> surface_output_surface( 188 std::unique_ptr<cc::SurfaceDisplayOutputSurface> surface_output_surface(
189 new cc::SurfaceDisplayOutputSurface( 189 new cc::SurfaceDisplayOutputSurface(
190 surface_manager_, compositor->surface_id_allocator(), display, 190 surface_manager_, compositor->surface_id_allocator(), display,
191 context_provider, shared_worker_context_provider_)); 191 context_provider, shared_worker_context_provider_));
192 compositor->SetOutputSurface(std::move(surface_output_surface)); 192 compositor->SetOutputSurface(std::move(surface_output_surface));
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 InProcessContextFactory::GetGpuMemoryBufferManager() { 244 InProcessContextFactory::GetGpuMemoryBufferManager() {
245 return &gpu_memory_buffer_manager_; 245 return &gpu_memory_buffer_manager_;
246 } 246 }
247 247
248 cc::TaskGraphRunner* InProcessContextFactory::GetTaskGraphRunner() { 248 cc::TaskGraphRunner* InProcessContextFactory::GetTaskGraphRunner() {
249 return &task_graph_runner_; 249 return &task_graph_runner_;
250 } 250 }
251 251
252 std::unique_ptr<cc::SurfaceIdAllocator> 252 std::unique_ptr<cc::SurfaceIdAllocator>
253 InProcessContextFactory::CreateSurfaceIdAllocator() { 253 InProcessContextFactory::CreateSurfaceIdAllocator() {
254 // TODO(fsamuel): Implement gpu_id.
254 std::unique_ptr<cc::SurfaceIdAllocator> allocator( 255 std::unique_ptr<cc::SurfaceIdAllocator> allocator(
255 new cc::SurfaceIdAllocator(next_surface_id_namespace_++)); 256 new cc::SurfaceIdAllocator(0 /* gpu_id */, next_surface_client_id_++));
256 if (surface_manager_) 257 if (surface_manager_)
257 allocator->RegisterSurfaceIdNamespace(surface_manager_); 258 allocator->RegisterSurfaceClientId(surface_manager_);
258 return allocator; 259 return allocator;
259 } 260 }
260 261
261 cc::SurfaceManager* InProcessContextFactory::GetSurfaceManager() { 262 cc::SurfaceManager* InProcessContextFactory::GetSurfaceManager() {
262 return surface_manager_; 263 return surface_manager_;
263 } 264 }
264 265
265 void InProcessContextFactory::ResizeDisplay(ui::Compositor* compositor, 266 void InProcessContextFactory::ResizeDisplay(ui::Compositor* compositor,
266 const gfx::Size& size) { 267 const gfx::Size& size) {
267 if (!per_compositor_data_.count(compositor)) 268 if (!per_compositor_data_.count(compositor))
268 return; 269 return;
269 per_compositor_data_[compositor]->Resize(size); 270 per_compositor_data_[compositor]->Resize(size);
270 } 271 }
271 272
272 void InProcessContextFactory::AddObserver(ContextFactoryObserver* observer) { 273 void InProcessContextFactory::AddObserver(ContextFactoryObserver* observer) {
273 observer_list_.AddObserver(observer); 274 observer_list_.AddObserver(observer);
274 } 275 }
275 276
276 void InProcessContextFactory::RemoveObserver(ContextFactoryObserver* observer) { 277 void InProcessContextFactory::RemoveObserver(ContextFactoryObserver* observer) {
277 observer_list_.RemoveObserver(observer); 278 observer_list_.RemoveObserver(observer);
278 } 279 }
279 280
280 } // namespace ui 281 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698