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

Side by Side Diff: content/browser/compositor/gpu_process_transport_factory.cc

Issue 767443002: Ensure Surface size always matches window size on swap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 "content/browser/compositor/gpu_process_transport_factory.h" 5 #include "content/browser/compositor/gpu_process_transport_factory.h"
6 6
7 #include <string> 7 #include <string>
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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 } 231 }
232 scoped_ptr<OnscreenDisplayClient> display_client(new OnscreenDisplayClient( 232 scoped_ptr<OnscreenDisplayClient> display_client(new OnscreenDisplayClient(
233 display_surface.Pass(), manager, compositor->GetRendererSettings(), 233 display_surface.Pass(), manager, compositor->GetRendererSettings(),
234 compositor->task_runner())); 234 compositor->task_runner()));
235 235
236 scoped_ptr<SurfaceDisplayOutputSurface> output_surface( 236 scoped_ptr<SurfaceDisplayOutputSurface> output_surface(
237 new SurfaceDisplayOutputSurface( 237 new SurfaceDisplayOutputSurface(
238 manager, compositor->surface_id_allocator(), context_provider)); 238 manager, compositor->surface_id_allocator(), context_provider));
239 display_client->set_surface_output_surface(output_surface.get()); 239 display_client->set_surface_output_surface(output_surface.get());
240 output_surface->set_display_client(display_client.get()); 240 output_surface->set_display_client(display_client.get());
241 display_client->display()->Resize(compositor->size());
241 data->display_client = display_client.Pass(); 242 data->display_client = display_client.Pass();
242 compositor->SetOutputSurface(output_surface.Pass()); 243 compositor->SetOutputSurface(output_surface.Pass());
243 return; 244 return;
244 } 245 }
245 246
246 if (!context_provider.get()) { 247 if (!context_provider.get()) {
247 if (compositor_thread_.get()) { 248 if (compositor_thread_.get()) {
248 LOG(FATAL) << "Failed to create UI context, but can't use software" 249 LOG(FATAL) << "Failed to create UI context, but can't use software"
249 " compositing with browser threaded compositing. Aborting."; 250 " compositing with browser threaded compositing. Aborting.";
250 } 251 }
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 BrowserGpuChannelHostFactory::instance()->GetGpuChannelId(); 369 BrowserGpuChannelHostFactory::instance()->GetGpuChannelId();
369 return handle; 370 return handle;
370 } 371 }
371 372
372 scoped_ptr<cc::SurfaceIdAllocator> 373 scoped_ptr<cc::SurfaceIdAllocator>
373 GpuProcessTransportFactory::CreateSurfaceIdAllocator() { 374 GpuProcessTransportFactory::CreateSurfaceIdAllocator() {
374 return make_scoped_ptr( 375 return make_scoped_ptr(
375 new cc::SurfaceIdAllocator(next_surface_id_namespace_++)); 376 new cc::SurfaceIdAllocator(next_surface_id_namespace_++));
376 } 377 }
377 378
379 void GpuProcessTransportFactory::ResizeDisplay(ui::Compositor* compositor,
380 const gfx::Size& size) {
381 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor);
382 if (it == per_compositor_data_.end())
383 return;
384 PerCompositorData* data = it->second;
385 DCHECK(data);
386 if (data->display_client)
387 data->display_client->display()->Resize(size);
388 }
389
378 cc::SurfaceManager* GpuProcessTransportFactory::GetSurfaceManager() { 390 cc::SurfaceManager* GpuProcessTransportFactory::GetSurfaceManager() {
379 return surface_manager_.get(); 391 return surface_manager_.get();
380 } 392 }
381 393
382 GLHelper* GpuProcessTransportFactory::GetGLHelper() { 394 GLHelper* GpuProcessTransportFactory::GetGLHelper() {
383 if (!gl_helper_ && !per_compositor_data_.empty()) { 395 if (!gl_helper_ && !per_compositor_data_.empty()) {
384 scoped_refptr<cc::ContextProvider> provider = 396 scoped_refptr<cc::ContextProvider> provider =
385 SharedMainThreadContextProvider(); 397 SharedMainThreadContextProvider();
386 if (provider.get()) 398 if (provider.get())
387 gl_helper_.reset(new GLHelper(provider->ContextGL(), 399 gl_helper_.reset(new GLHelper(provider->ContextGL(),
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, 517 FOR_EACH_OBSERVER(ImageTransportFactoryObserver,
506 observer_list_, 518 observer_list_,
507 OnLostResources()); 519 OnLostResources());
508 520
509 // Kill things that use the shared context before killing the shared context. 521 // Kill things that use the shared context before killing the shared context.
510 lost_gl_helper.reset(); 522 lost_gl_helper.reset();
511 lost_shared_main_thread_contexts = NULL; 523 lost_shared_main_thread_contexts = NULL;
512 } 524 }
513 525
514 } // namespace content 526 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698