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

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

Issue 1192633003: content: Rename raster threads to worker threads. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 "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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 #endif 68 #endif
69 69
70 using cc::ContextProvider; 70 using cc::ContextProvider;
71 using gpu::gles2::GLES2Interface; 71 using gpu::gles2::GLES2Interface;
72 72
73 static const int kNumRetriesBeforeSoftwareFallback = 4; 73 static const int kNumRetriesBeforeSoftwareFallback = 4;
74 74
75 namespace content { 75 namespace content {
76 namespace { 76 namespace {
77 77
78 class RasterThread : public base::SimpleThread { 78 class WorkerThread : public base::SimpleThread {
79 public: 79 public:
80 RasterThread(cc::TaskGraphRunner* task_graph_runner) 80 WorkerThread(cc::TaskGraphRunner* task_graph_runner)
81 : base::SimpleThread("CompositorTileWorker1"), 81 : base::SimpleThread("Browser Worker"),
82 task_graph_runner_(task_graph_runner) {} 82 task_graph_runner_(task_graph_runner) {}
83 83
84 // Overridden from base::SimpleThread: 84 // Overridden from base::SimpleThread:
85 void Run() override { task_graph_runner_->Run(); } 85 void Run() override { task_graph_runner_->Run(); }
86 86
87 private: 87 private:
88 cc::TaskGraphRunner* task_graph_runner_; 88 cc::TaskGraphRunner* task_graph_runner_;
89 89
90 DISALLOW_COPY_AND_ASSIGN(RasterThread); 90 DISALLOW_COPY_AND_ASSIGN(WorkerThread);
91 }; 91 };
92 92
93 } // namespace 93 } // namespace
94 94
95 struct GpuProcessTransportFactory::PerCompositorData { 95 struct GpuProcessTransportFactory::PerCompositorData {
96 int surface_id; 96 int surface_id;
97 BrowserCompositorOutputSurface* surface; 97 BrowserCompositorOutputSurface* surface;
98 ReflectorImpl* reflector; 98 ReflectorImpl* reflector;
99 scoped_ptr<cc::OnscreenDisplayClient> display_client; 99 scoped_ptr<cc::OnscreenDisplayClient> display_client;
100 100
101 PerCompositorData() : surface_id(0), surface(nullptr), reflector(nullptr) {} 101 PerCompositorData() : surface_id(0), surface(nullptr), reflector(nullptr) {}
102 }; 102 };
103 103
104 GpuProcessTransportFactory::GpuProcessTransportFactory() 104 GpuProcessTransportFactory::GpuProcessTransportFactory()
105 : next_surface_id_namespace_(1u), 105 : next_surface_id_namespace_(1u),
106 task_graph_runner_(new cc::TaskGraphRunner), 106 task_graph_runner_(new cc::TaskGraphRunner),
107 callback_factory_(this) { 107 callback_factory_(this) {
108 ui::Layer::InitializeUILayerSettings(); 108 ui::Layer::InitializeUILayerSettings();
109 109
110 if (UseSurfacesEnabled()) 110 if (UseSurfacesEnabled())
111 surface_manager_ = make_scoped_ptr(new cc::SurfaceManager); 111 surface_manager_ = make_scoped_ptr(new cc::SurfaceManager);
112 112
113 raster_thread_.reset(new RasterThread(task_graph_runner_.get())); 113 worker_thread_.reset(new WorkerThread(task_graph_runner_.get()));
114 raster_thread_->Start(); 114 worker_thread_->Start();
115 #if defined(OS_WIN) 115 #if defined(OS_WIN)
116 software_backing_.reset(new OutputDeviceBacking); 116 software_backing_.reset(new OutputDeviceBacking);
117 #endif 117 #endif
118 } 118 }
119 119
120 GpuProcessTransportFactory::~GpuProcessTransportFactory() { 120 GpuProcessTransportFactory::~GpuProcessTransportFactory() {
121 DCHECK(per_compositor_data_.empty()); 121 DCHECK(per_compositor_data_.empty());
122 122
123 // Make sure the lost context callback doesn't try to run during destruction. 123 // Make sure the lost context callback doesn't try to run during destruction.
124 callback_factory_.InvalidateWeakPtrs(); 124 callback_factory_.InvalidateWeakPtrs();
125 125
126 task_graph_runner_->Shutdown(); 126 task_graph_runner_->Shutdown();
127 if (raster_thread_) 127 if (worker_thread_)
128 raster_thread_->Join(); 128 worker_thread_->Join();
129 } 129 }
130 130
131 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> 131 scoped_ptr<WebGraphicsContext3DCommandBufferImpl>
132 GpuProcessTransportFactory::CreateOffscreenCommandBufferContext() { 132 GpuProcessTransportFactory::CreateOffscreenCommandBufferContext() {
133 CauseForGpuLaunch cause = 133 CauseForGpuLaunch cause =
134 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE; 134 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE;
135 scoped_refptr<GpuChannelHost> gpu_channel_host( 135 scoped_refptr<GpuChannelHost> gpu_channel_host(
136 BrowserGpuChannelHostFactory::instance()->EstablishGpuChannelSync(cause)); 136 BrowserGpuChannelHostFactory::instance()->EstablishGpuChannelSync(cause));
137 return CreateContextCommon(gpu_channel_host, 0); 137 return CreateContextCommon(gpu_channel_host, 0);
138 } 138 }
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, 615 FOR_EACH_OBSERVER(ImageTransportFactoryObserver,
616 observer_list_, 616 observer_list_,
617 OnLostResources()); 617 OnLostResources());
618 618
619 // Kill things that use the shared context before killing the shared context. 619 // Kill things that use the shared context before killing the shared context.
620 lost_gl_helper.reset(); 620 lost_gl_helper.reset();
621 lost_shared_main_thread_contexts = NULL; 621 lost_shared_main_thread_contexts = NULL;
622 } 622 }
623 623
624 } // namespace content 624 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/compositor/gpu_process_transport_factory.h ('k') | content/browser/gpu/compositor_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698