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

Side by Side Diff: chrome/browser/browser_process_impl.cc

Issue 7054005: Fix gpu acceleration with --in-process-gpu (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Make --single-process mode work too Created 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/browser_process_impl.h" 5 #include "chrome/browser/browser_process_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 #endif 108 #endif
109 109
110 BrowserProcessImpl::BrowserProcessImpl(const CommandLine& command_line) 110 BrowserProcessImpl::BrowserProcessImpl(const CommandLine& command_line)
111 : created_resource_dispatcher_host_(false), 111 : created_resource_dispatcher_host_(false),
112 created_metrics_service_(false), 112 created_metrics_service_(false),
113 created_io_thread_(false), 113 created_io_thread_(false),
114 created_file_thread_(false), 114 created_file_thread_(false),
115 created_db_thread_(false), 115 created_db_thread_(false),
116 created_process_launcher_thread_(false), 116 created_process_launcher_thread_(false),
117 created_cache_thread_(false), 117 created_cache_thread_(false),
118 created_gpu_thread_(false),
119 created_watchdog_thread_(false), 118 created_watchdog_thread_(false),
120 #if defined(OS_CHROMEOS) 119 #if defined(OS_CHROMEOS)
121 created_web_socket_proxy_thread_(false), 120 created_web_socket_proxy_thread_(false),
122 #endif 121 #endif
123 created_profile_manager_(false), 122 created_profile_manager_(false),
124 created_local_state_(false), 123 created_local_state_(false),
125 created_icon_manager_(false), 124 created_icon_manager_(false),
126 created_devtools_manager_(false), 125 created_devtools_manager_(false),
127 created_sidebar_manager_(false), 126 created_sidebar_manager_(false),
128 created_browser_policy_connector_(false), 127 created_browser_policy_connector_(false),
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 #endif 230 #endif
232 231
233 // Wait for removing plugin data to finish before shutting down the IO thread. 232 // Wait for removing plugin data to finish before shutting down the IO thread.
234 WaitForPluginDataRemoverToFinish(); 233 WaitForPluginDataRemoverToFinish();
235 234
236 // Destroying the GpuProcessHostUIShims on the UI thread posts a task to 235 // Destroying the GpuProcessHostUIShims on the UI thread posts a task to
237 // delete related objects on the GPU thread. This must be done before 236 // delete related objects on the GPU thread. This must be done before
238 // stopping the GPU thread. The GPU thread will close IPC channels to renderer 237 // stopping the GPU thread. The GPU thread will close IPC channels to renderer
239 // processes so this has to happen before stopping the IO thread. 238 // processes so this has to happen before stopping the IO thread.
240 GpuProcessHostUIShim::DestroyAll(); 239 GpuProcessHostUIShim::DestroyAll();
241 gpu_thread_.reset();
242 240
243 // Need to stop io_thread_ before resource_dispatcher_host_, since 241 // Need to stop io_thread_ before resource_dispatcher_host_, since
244 // io_thread_ may still deref ResourceDispatcherHost and handle resource 242 // io_thread_ may still deref ResourceDispatcherHost and handle resource
245 // request before going away. 243 // request before going away.
246 io_thread_.reset(); 244 io_thread_.reset();
247 245
248 // The IO thread was the only user of this thread. 246 // The IO thread was the only user of this thread.
249 cache_thread_.reset(); 247 cache_thread_.reset();
250 248
251 // Stop the process launcher thread after the IO thread, in case the IO thread 249 // Stop the process launcher thread after the IO thread, in case the IO thread
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 return process_launcher_thread_.get(); 414 return process_launcher_thread_.get();
417 } 415 }
418 416
419 base::Thread* BrowserProcessImpl::cache_thread() { 417 base::Thread* BrowserProcessImpl::cache_thread() {
420 DCHECK(CalledOnValidThread()); 418 DCHECK(CalledOnValidThread());
421 if (!created_cache_thread_) 419 if (!created_cache_thread_)
422 CreateCacheThread(); 420 CreateCacheThread();
423 return cache_thread_.get(); 421 return cache_thread_.get();
424 } 422 }
425 423
426 base::Thread* BrowserProcessImpl::gpu_thread() {
427 DCHECK(CalledOnValidThread());
428 if (!created_gpu_thread_)
429 CreateGpuThread();
430 return gpu_thread_.get();
431 }
432
433 #if defined(USE_X11) 424 #if defined(USE_X11)
434 base::Thread* BrowserProcessImpl::background_x11_thread() { 425 base::Thread* BrowserProcessImpl::background_x11_thread() {
435 DCHECK(CalledOnValidThread()); 426 DCHECK(CalledOnValidThread());
436 // The BACKGROUND_X11 thread is created when the IO thread is created. 427 // The BACKGROUND_X11 thread is created when the IO thread is created.
437 if (!created_io_thread_) 428 if (!created_io_thread_)
438 CreateIOThread(); 429 CreateIOThread();
439 return background_x11_thread_.get(); 430 return background_x11_thread_.get();
440 } 431 }
441 #endif 432 #endif
442 433
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 833
843 scoped_ptr<base::Thread> thread( 834 scoped_ptr<base::Thread> thread(
844 new BrowserThread(BrowserThread::CACHE)); 835 new BrowserThread(BrowserThread::CACHE));
845 base::Thread::Options options; 836 base::Thread::Options options;
846 options.message_loop_type = MessageLoop::TYPE_IO; 837 options.message_loop_type = MessageLoop::TYPE_IO;
847 if (!thread->StartWithOptions(options)) 838 if (!thread->StartWithOptions(options))
848 return; 839 return;
849 cache_thread_.swap(thread); 840 cache_thread_.swap(thread);
850 } 841 }
851 842
852 void BrowserProcessImpl::CreateGpuThread() {
853 DCHECK(!created_gpu_thread_ && !gpu_thread_.get());
854 created_gpu_thread_ = true;
855
856 scoped_ptr<base::Thread> thread(new BrowserThread(BrowserThread::GPU));
857
858 base::Thread::Options options;
859 #if defined(OS_WIN)
860 // On Windows the GPU thread needs to pump the compositor child window's
861 // message loop. TODO(apatrick): make this an IO thread if / when we get rid
862 // of this child window. Unfortunately it might always be necessary for
863 // Windows XP because we cannot share the backing store textures between
864 // processes.
865 options.message_loop_type = MessageLoop::TYPE_UI;
866 #else
867 options.message_loop_type = MessageLoop::TYPE_IO;
868 #endif
869
870 if (!thread->StartWithOptions(options))
871 return;
872 gpu_thread_.swap(thread);
873 }
874
875 void BrowserProcessImpl::CreateWatchdogThread() { 843 void BrowserProcessImpl::CreateWatchdogThread() {
876 DCHECK(!created_watchdog_thread_ && watchdog_thread_.get() == NULL); 844 DCHECK(!created_watchdog_thread_ && watchdog_thread_.get() == NULL);
877 created_watchdog_thread_ = true; 845 created_watchdog_thread_ = true;
878 846
879 scoped_ptr<WatchDogThread> thread(new WatchDogThread()); 847 scoped_ptr<WatchDogThread> thread(new WatchDogThread());
880 if (!thread->Start()) 848 if (!thread->Start())
881 return; 849 return;
882 watchdog_thread_.swap(thread); 850 watchdog_thread_.swap(thread);
883 } 851 }
884 852
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 } 1089 }
1122 1090
1123 void BrowserProcessImpl::OnAutoupdateTimer() { 1091 void BrowserProcessImpl::OnAutoupdateTimer() {
1124 if (CanAutorestartForUpdate()) { 1092 if (CanAutorestartForUpdate()) {
1125 DLOG(WARNING) << "Detected update. Restarting browser."; 1093 DLOG(WARNING) << "Detected update. Restarting browser.";
1126 RestartPersistentInstance(); 1094 RestartPersistentInstance();
1127 } 1095 }
1128 } 1096 }
1129 1097
1130 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) 1098 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698