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

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: add comment 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
« no previous file with comments | « chrome/browser/browser_process_impl.h ('k') | chrome/test/testing_browser_process.h » ('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 (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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 #endif 110 #endif
111 111
112 BrowserProcessImpl::BrowserProcessImpl(const CommandLine& command_line) 112 BrowserProcessImpl::BrowserProcessImpl(const CommandLine& command_line)
113 : created_resource_dispatcher_host_(false), 113 : created_resource_dispatcher_host_(false),
114 created_metrics_service_(false), 114 created_metrics_service_(false),
115 created_io_thread_(false), 115 created_io_thread_(false),
116 created_file_thread_(false), 116 created_file_thread_(false),
117 created_db_thread_(false), 117 created_db_thread_(false),
118 created_process_launcher_thread_(false), 118 created_process_launcher_thread_(false),
119 created_cache_thread_(false), 119 created_cache_thread_(false),
120 created_gpu_thread_(false),
121 created_watchdog_thread_(false), 120 created_watchdog_thread_(false),
122 #if defined(OS_CHROMEOS) 121 #if defined(OS_CHROMEOS)
123 created_web_socket_proxy_thread_(false), 122 created_web_socket_proxy_thread_(false),
124 #endif 123 #endif
125 created_profile_manager_(false), 124 created_profile_manager_(false),
126 created_local_state_(false), 125 created_local_state_(false),
127 created_icon_manager_(false), 126 created_icon_manager_(false),
128 created_devtools_manager_(false), 127 created_devtools_manager_(false),
129 created_sidebar_manager_(false), 128 created_sidebar_manager_(false),
130 created_browser_policy_connector_(false), 129 created_browser_policy_connector_(false),
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 #endif 232 #endif
234 233
235 // Wait for removing plugin data to finish before shutting down the IO thread. 234 // Wait for removing plugin data to finish before shutting down the IO thread.
236 WaitForPluginDataRemoverToFinish(); 235 WaitForPluginDataRemoverToFinish();
237 236
238 // Destroying the GpuProcessHostUIShims on the UI thread posts a task to 237 // Destroying the GpuProcessHostUIShims on the UI thread posts a task to
239 // delete related objects on the GPU thread. This must be done before 238 // delete related objects on the GPU thread. This must be done before
240 // stopping the GPU thread. The GPU thread will close IPC channels to renderer 239 // stopping the GPU thread. The GPU thread will close IPC channels to renderer
241 // processes so this has to happen before stopping the IO thread. 240 // processes so this has to happen before stopping the IO thread.
242 GpuProcessHostUIShim::DestroyAll(); 241 GpuProcessHostUIShim::DestroyAll();
243 gpu_thread_.reset();
244 242
245 // Need to stop io_thread_ before resource_dispatcher_host_, since 243 // Need to stop io_thread_ before resource_dispatcher_host_, since
246 // io_thread_ may still deref ResourceDispatcherHost and handle resource 244 // io_thread_ may still deref ResourceDispatcherHost and handle resource
247 // request before going away. 245 // request before going away.
248 io_thread_.reset(); 246 io_thread_.reset();
249 247
250 // The IO thread was the only user of this thread. 248 // The IO thread was the only user of this thread.
251 cache_thread_.reset(); 249 cache_thread_.reset();
252 250
253 // Stop the process launcher thread after the IO thread, in case the IO thread 251 // 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
418 return process_launcher_thread_.get(); 416 return process_launcher_thread_.get();
419 } 417 }
420 418
421 base::Thread* BrowserProcessImpl::cache_thread() { 419 base::Thread* BrowserProcessImpl::cache_thread() {
422 DCHECK(CalledOnValidThread()); 420 DCHECK(CalledOnValidThread());
423 if (!created_cache_thread_) 421 if (!created_cache_thread_)
424 CreateCacheThread(); 422 CreateCacheThread();
425 return cache_thread_.get(); 423 return cache_thread_.get();
426 } 424 }
427 425
428 base::Thread* BrowserProcessImpl::gpu_thread() {
429 DCHECK(CalledOnValidThread());
430 if (!created_gpu_thread_)
431 CreateGpuThread();
432 return gpu_thread_.get();
433 }
434
435 #if defined(USE_X11) 426 #if defined(USE_X11)
436 base::Thread* BrowserProcessImpl::background_x11_thread() { 427 base::Thread* BrowserProcessImpl::background_x11_thread() {
437 DCHECK(CalledOnValidThread()); 428 DCHECK(CalledOnValidThread());
438 // The BACKGROUND_X11 thread is created when the IO thread is created. 429 // The BACKGROUND_X11 thread is created when the IO thread is created.
439 if (!created_io_thread_) 430 if (!created_io_thread_)
440 CreateIOThread(); 431 CreateIOThread();
441 return background_x11_thread_.get(); 432 return background_x11_thread_.get();
442 } 433 }
443 #endif 434 #endif
444 435
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 847
857 scoped_ptr<base::Thread> thread( 848 scoped_ptr<base::Thread> thread(
858 new BrowserThread(BrowserThread::CACHE)); 849 new BrowserThread(BrowserThread::CACHE));
859 base::Thread::Options options; 850 base::Thread::Options options;
860 options.message_loop_type = MessageLoop::TYPE_IO; 851 options.message_loop_type = MessageLoop::TYPE_IO;
861 if (!thread->StartWithOptions(options)) 852 if (!thread->StartWithOptions(options))
862 return; 853 return;
863 cache_thread_.swap(thread); 854 cache_thread_.swap(thread);
864 } 855 }
865 856
866 void BrowserProcessImpl::CreateGpuThread() {
867 DCHECK(!created_gpu_thread_ && !gpu_thread_.get());
868 created_gpu_thread_ = true;
869
870 scoped_ptr<base::Thread> thread(new BrowserThread(BrowserThread::GPU));
871
872 base::Thread::Options options;
873 #if defined(OS_WIN)
874 // On Windows the GPU thread needs to pump the compositor child window's
875 // message loop. TODO(apatrick): make this an IO thread if / when we get rid
876 // of this child window. Unfortunately it might always be necessary for
877 // Windows XP because we cannot share the backing store textures between
878 // processes.
879 options.message_loop_type = MessageLoop::TYPE_UI;
880 #else
881 options.message_loop_type = MessageLoop::TYPE_IO;
882 #endif
883
884 if (!thread->StartWithOptions(options))
885 return;
886 gpu_thread_.swap(thread);
887 }
888
889 void BrowserProcessImpl::CreateWatchdogThread() { 857 void BrowserProcessImpl::CreateWatchdogThread() {
890 DCHECK(!created_watchdog_thread_ && watchdog_thread_.get() == NULL); 858 DCHECK(!created_watchdog_thread_ && watchdog_thread_.get() == NULL);
891 created_watchdog_thread_ = true; 859 created_watchdog_thread_ = true;
892 860
893 scoped_ptr<WatchDogThread> thread(new WatchDogThread()); 861 scoped_ptr<WatchDogThread> thread(new WatchDogThread());
894 if (!thread->Start()) 862 if (!thread->Start())
895 return; 863 return;
896 watchdog_thread_.swap(thread); 864 watchdog_thread_.swap(thread);
897 } 865 }
898 866
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 } 1111 }
1144 1112
1145 void BrowserProcessImpl::OnAutoupdateTimer() { 1113 void BrowserProcessImpl::OnAutoupdateTimer() {
1146 if (CanAutorestartForUpdate()) { 1114 if (CanAutorestartForUpdate()) {
1147 DLOG(WARNING) << "Detected update. Restarting browser."; 1115 DLOG(WARNING) << "Detected update. Restarting browser.";
1148 RestartPersistentInstance(); 1116 RestartPersistentInstance();
1149 } 1117 }
1150 } 1118 }
1151 1119
1152 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) 1120 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
OLDNEW
« no previous file with comments | « chrome/browser/browser_process_impl.h ('k') | chrome/test/testing_browser_process.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698