Chromium Code Reviews

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

Issue 781163003: Flip flag to turn CrOS Browser Compositor Single Threaded (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « no previous file | ui/compositor/test/in_process_context_factory.cc » ('j') | 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 "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 56 matching lines...)
67 int surface_id; 67 int surface_id;
68 scoped_refptr<ReflectorImpl> reflector; 68 scoped_refptr<ReflectorImpl> reflector;
69 scoped_ptr<cc::OnscreenDisplayClient> display_client; 69 scoped_ptr<cc::OnscreenDisplayClient> display_client;
70 }; 70 };
71 71
72 GpuProcessTransportFactory::GpuProcessTransportFactory() 72 GpuProcessTransportFactory::GpuProcessTransportFactory()
73 : next_surface_id_namespace_(1u), 73 : next_surface_id_namespace_(1u),
74 callback_factory_(this) { 74 callback_factory_(this) {
75 output_surface_proxy_ = new BrowserCompositorOutputSurfaceProxy( 75 output_surface_proxy_ = new BrowserCompositorOutputSurfaceProxy(
76 &output_surface_map_); 76 &output_surface_map_);
77 #if defined(OS_CHROMEOS) 77
78 bool use_thread = !base::CommandLine::ForCurrentProcess()->HasSwitch(
79 switches::kUIDisableThreadedCompositing);
80 #else
81 bool use_thread = false;
82 #endif
83 if (use_thread) {
84 compositor_thread_.reset(new base::Thread("Browser Compositor"));
85 compositor_thread_->Start();
86 }
87 if (UseSurfacesEnabled()) 78 if (UseSurfacesEnabled())
88 surface_manager_ = make_scoped_ptr(new cc::SurfaceManager); 79 surface_manager_ = make_scoped_ptr(new cc::SurfaceManager);
89 } 80 }
90 81
91 GpuProcessTransportFactory::~GpuProcessTransportFactory() { 82 GpuProcessTransportFactory::~GpuProcessTransportFactory() {
92 DCHECK(per_compositor_data_.empty()); 83 DCHECK(per_compositor_data_.empty());
93 84
94 // Make sure the lost context callback doesn't try to run during destruction. 85 // Make sure the lost context callback doesn't try to run during destruction.
95 callback_factory_.InvalidateWeakPtrs(); 86 callback_factory_.InvalidateWeakPtrs();
96 } 87 }
(...skipping 145 matching lines...)
242 output_surface->set_display_client(display_client.get()); 233 output_surface->set_display_client(display_client.get());
243 display_client->display()->Resize(compositor->size()); 234 display_client->display()->Resize(compositor->size());
244 data->display_client = display_client.Pass(); 235 data->display_client = display_client.Pass();
245 compositor->SetOutputSurface(output_surface.Pass()); 236 compositor->SetOutputSurface(output_surface.Pass());
246 return; 237 return;
247 } 238 }
248 239
249 if (!context_provider.get()) { 240 if (!context_provider.get()) {
250 if (compositor_thread_.get()) { 241 if (compositor_thread_.get()) {
251 LOG(FATAL) << "Failed to create UI context, but can't use software" 242 LOG(FATAL) << "Failed to create UI context, but can't use software"
252 " compositing with browser threaded compositing. Aborting."; 243 " compositing with browser threaded compositing. Aborting.";
253 } 244 }
254 245
255 scoped_ptr<SoftwareBrowserCompositorOutputSurface> surface( 246 scoped_ptr<SoftwareBrowserCompositorOutputSurface> surface(
256 new SoftwareBrowserCompositorOutputSurface( 247 new SoftwareBrowserCompositorOutputSurface(
257 output_surface_proxy_, 248 output_surface_proxy_,
258 CreateSoftwareOutputDevice(compositor.get()), 249 CreateSoftwareOutputDevice(compositor.get()),
259 data->surface_id, 250 data->surface_id,
260 &output_surface_map_, 251 &output_surface_map_,
261 compositor->vsync_manager())); 252 compositor->vsync_manager()));
262 compositor->SetOutputSurface(surface.Pass()); 253 compositor->SetOutputSurface(surface.Pass());
(...skipping 276 matching lines...)
539 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, 530 FOR_EACH_OBSERVER(ImageTransportFactoryObserver,
540 observer_list_, 531 observer_list_,
541 OnLostResources()); 532 OnLostResources());
542 533
543 // Kill things that use the shared context before killing the shared context. 534 // Kill things that use the shared context before killing the shared context.
544 lost_gl_helper.reset(); 535 lost_gl_helper.reset();
545 lost_shared_main_thread_contexts = NULL; 536 lost_shared_main_thread_contexts = NULL;
546 } 537 }
547 538
548 } // namespace content 539 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | ui/compositor/test/in_process_context_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine