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

Unified Diff: content/browser/compositor/gpu_process_transport_factory.cc

Issue 277713002: ui/compositor: move the browser compositor thread to the ContextFactory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, fix includes Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/compositor/gpu_process_transport_factory.cc
diff --git a/content/browser/compositor/gpu_process_transport_factory.cc b/content/browser/compositor/gpu_process_transport_factory.cc
index 16f600a85ae6e110687acf2b3f764ceb78733d51..7569ce5684f608d96c66f93fb43ab5cad8580839 100644
--- a/content/browser/compositor/gpu_process_transport_factory.cc
+++ b/content/browser/compositor/gpu_process_transport_factory.cc
@@ -11,6 +11,7 @@
#include "base/location.h"
#include "base/message_loop/message_loop.h"
#include "base/metrics/histogram.h"
+#include "base/threading/thread.h"
#include "cc/output/compositor_frame.h"
#include "cc/output/output_surface.h"
#include "content/browser/compositor/browser_compositor_output_surface.h"
@@ -62,6 +63,16 @@ GpuProcessTransportFactory::GpuProcessTransportFactory()
: callback_factory_(this) {
output_surface_proxy_ = new BrowserCompositorOutputSurfaceProxy(
&output_surface_map_);
+#if defined(OS_CHROMEOS)
+ bool use_thread = !CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kUIDisableThreadedCompositing);
+#else
+ bool use_thread = false;
+#endif
+ if (use_thread) {
+ compositor_thread_.reset(new base::Thread("Browser Compositor"));
+ compositor_thread_->Start();
+ }
}
GpuProcessTransportFactory::~GpuProcessTransportFactory() {
@@ -134,7 +145,7 @@ scoped_ptr<cc::OutputSurface> GpuProcessTransportFactory::CreateOutputSurface(
UMA_HISTOGRAM_BOOLEAN("Aura.CreatedGpuBrowserCompositor", !!context_provider);
if (!context_provider.get()) {
- if (ui::Compositor::WasInitializedWithThread()) {
+ if (compositor_thread_.get()) {
LOG(FATAL) << "Failed to create UI context, but can't use software"
" compositing with browser threaded compositing. Aborting.";
}
@@ -150,7 +161,7 @@ scoped_ptr<cc::OutputSurface> GpuProcessTransportFactory::CreateOutputSurface(
}
scoped_refptr<base::SingleThreadTaskRunner> compositor_thread_task_runner =
- ui::Compositor::GetCompositorMessageLoop();
+ GetCompositorMessageLoop();
if (!compositor_thread_task_runner.get())
compositor_thread_task_runner = base::MessageLoopProxy::current();
@@ -178,8 +189,11 @@ scoped_refptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector(
PerCompositorData* data = per_compositor_data_[source];
DCHECK(data);
- data->reflector = new ReflectorImpl(
- source, target, &output_surface_map_, data->surface_id);
+ data->reflector = new ReflectorImpl(source,
+ target,
+ &output_surface_map_,
+ GetCompositorMessageLoop(),
+ data->surface_id);
return data->reflector;
}
@@ -222,6 +236,12 @@ cc::SharedBitmapManager* GpuProcessTransportFactory::GetSharedBitmapManager() {
return HostSharedBitmapManager::current();
}
+base::MessageLoopProxy* GpuProcessTransportFactory::GetCompositorMessageLoop() {
+ if (!compositor_thread_)
+ return NULL;
+ return compositor_thread_->message_loop_proxy();
+}
+
gfx::GLSurfaceHandle GpuProcessTransportFactory::GetSharedSurfaceHandle() {
gfx::GLSurfaceHandle handle = gfx::GLSurfaceHandle(
gfx::kNullPluginWindow, gfx::TEXTURE_TRANSPORT);
« no previous file with comments | « content/browser/compositor/gpu_process_transport_factory.h ('k') | content/browser/compositor/reflector_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698