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

Side by Side Diff: content/browser/gpu/gpu_process_host.cc

Issue 19502003: Cut some more dependencies from browser to child for multiple_dll mode (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/gpu/gpu_process_host.h" 5 #include "content/browser/gpu/gpu_process_host.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/base_switches.h" 8 #include "base/base_switches.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 } 272 }
273 } 273 }
274 274
275 private: 275 private:
276 CommandLine* cmd_line_; 276 CommandLine* cmd_line_;
277 }; 277 };
278 #endif // defined(OS_WIN) 278 #endif // defined(OS_WIN)
279 279
280 } // anonymous namespace 280 } // anonymous namespace
281 281
282 // Single process not supported in multiple dll mode currently.
283 #if !defined(CHROME_MULTIPLE_DLL)
282 // This class creates a GPU thread (instead of a GPU process), when running 284 // This class creates a GPU thread (instead of a GPU process), when running
283 // with --in-process-gpu or --single-process. 285 // with --in-process-gpu or --single-process.
284 class GpuMainThread : public base::Thread { 286 class GpuMainThread : public base::Thread {
285 public: 287 public:
286 explicit GpuMainThread(const std::string& channel_id) 288 explicit GpuMainThread(const std::string& channel_id)
287 : base::Thread("Chrome_InProcGpuThread"), 289 : base::Thread("Chrome_InProcGpuThread"),
288 channel_id_(channel_id), 290 channel_id_(channel_id),
289 gpu_process_(NULL) { 291 gpu_process_(NULL) {
290 } 292 }
291 293
(...skipping 13 matching lines...) Expand all
305 delete gpu_process_; 307 delete gpu_process_;
306 } 308 }
307 309
308 private: 310 private:
309 std::string channel_id_; 311 std::string channel_id_;
310 // Deleted in CleanUp() on the gpu thread, so don't use smart pointers. 312 // Deleted in CleanUp() on the gpu thread, so don't use smart pointers.
311 GpuProcess* gpu_process_; 313 GpuProcess* gpu_process_;
312 314
313 DISALLOW_COPY_AND_ASSIGN(GpuMainThread); 315 DISALLOW_COPY_AND_ASSIGN(GpuMainThread);
314 }; 316 };
317 #endif // !CHROME_MULTIPLE_DLL
315 318
316 // static 319 // static
317 bool GpuProcessHost::ValidateHost(GpuProcessHost* host) { 320 bool GpuProcessHost::ValidateHost(GpuProcessHost* host) {
318 if (!host) 321 if (!host)
319 return false; 322 return false;
320 323
321 // The Gpu process is invalid if it's not using SwiftShader, the card is 324 // The Gpu process is invalid if it's not using SwiftShader, the card is
322 // blacklisted, and we can kill it and start over. 325 // blacklisted, and we can kill it and start over.
323 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess) || 326 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess) ||
324 CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessGPU) || 327 CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessGPU) ||
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 592
590 bool GpuProcessHost::Init() { 593 bool GpuProcessHost::Init() {
591 init_start_time_ = base::TimeTicks::Now(); 594 init_start_time_ = base::TimeTicks::Now();
592 595
593 TRACE_EVENT_INSTANT0("gpu", "LaunchGpuProcess", TRACE_EVENT_SCOPE_THREAD); 596 TRACE_EVENT_INSTANT0("gpu", "LaunchGpuProcess", TRACE_EVENT_SCOPE_THREAD);
594 597
595 std::string channel_id = process_->GetHost()->CreateChannel(); 598 std::string channel_id = process_->GetHost()->CreateChannel();
596 if (channel_id.empty()) 599 if (channel_id.empty())
597 return false; 600 return false;
598 601
602 // Single process not supported in multiple dll mode currently.
603 #if !defined(CHROME_MULTIPLE_DLL)
599 if (in_process_) { 604 if (in_process_) {
600 CommandLine::ForCurrentProcess()->AppendSwitch( 605 CommandLine::ForCurrentProcess()->AppendSwitch(
601 switches::kDisableGpuWatchdog); 606 switches::kDisableGpuWatchdog);
602 607
603 in_process_gpu_thread_.reset(new GpuMainThread(channel_id)); 608 in_process_gpu_thread_.reset(new GpuMainThread(channel_id));
604 in_process_gpu_thread_->Start(); 609 in_process_gpu_thread_->Start();
605 610
606 OnProcessLaunched(); // Fake a callback that the process is ready. 611 OnProcessLaunched(); // Fake a callback that the process is ready.
607 } else if (!LaunchGpuProcess(channel_id)) { 612 } else
613 #endif // !CHROME_MULTIPLE_DLL
614 if (!LaunchGpuProcess(channel_id)) {
608 return false; 615 return false;
609 } 616 }
610 617
611 if (!Send(new GpuMsg_Initialize())) 618 if (!Send(new GpuMsg_Initialize()))
612 return false; 619 return false;
613 620
614 return true; 621 return true;
615 } 622 }
616 623
617 void GpuProcessHost::RouteOnUIThread(const IPC::Message& message) { 624 void GpuProcessHost::RouteOnUIThread(const IPC::Message& message) {
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); 1277 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader");
1271 ClientIdToShaderCacheMap::iterator iter = 1278 ClientIdToShaderCacheMap::iterator iter =
1272 client_id_to_shader_cache_.find(client_id); 1279 client_id_to_shader_cache_.find(client_id);
1273 // If the cache doesn't exist then this is an off the record profile. 1280 // If the cache doesn't exist then this is an off the record profile.
1274 if (iter == client_id_to_shader_cache_.end()) 1281 if (iter == client_id_to_shader_cache_.end())
1275 return; 1282 return;
1276 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); 1283 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader);
1277 } 1284 }
1278 1285
1279 } // namespace content 1286 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698