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

Side by Side Diff: content/browser/browser_process_sub_thread.cc

Issue 106223002: chrome power profiler chrome side changes (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years 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 (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/browser_process_sub_thread.h" 5 #include "content/browser/browser_process_sub_thread.h"
6 6
7 #include "base/debug/leak_tracker.h" 7 #include "base/debug/leak_tracker.h"
8 #include "base/threading/thread_restrictions.h" 8 #include "base/threading/thread_restrictions.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "content/browser/browser_child_process_host_impl.h" 10 #include "content/browser/browser_child_process_host_impl.h"
11 #include "content/browser/notification_service_impl.h" 11 #include "content/browser/notification_service_impl.h"
12 #include "content/browser/power_profiler/power_profiler_service.h"
12 #include "net/url_request/url_fetcher.h" 13 #include "net/url_request/url_fetcher.h"
13 #include "net/url_request/url_request.h" 14 #include "net/url_request/url_request.h"
14 15
15 #if defined(OS_WIN) 16 #if defined(OS_WIN)
16 #include "base/win/scoped_com_initializer.h" 17 #include "base/win/scoped_com_initializer.h"
17 #endif 18 #endif
18 19
19 namespace content { 20 namespace content {
20 21
21 BrowserProcessSubThread::BrowserProcessSubThread(BrowserThread::ID identifier) 22 BrowserProcessSubThread::BrowserProcessSubThread(BrowserThread::ID identifier)
(...skipping 13 matching lines...) Expand all
35 36
36 BrowserThreadImpl::Init(); 37 BrowserThreadImpl::Init();
37 38
38 if (BrowserThread::CurrentlyOn(BrowserThread::IO)) { 39 if (BrowserThread::CurrentlyOn(BrowserThread::IO)) {
39 // Though this thread is called the "IO" thread, it actually just routes 40 // Though this thread is called the "IO" thread, it actually just routes
40 // messages around; it shouldn't be allowed to perform any blocking disk 41 // messages around; it shouldn't be allowed to perform any blocking disk
41 // I/O. 42 // I/O.
42 base::ThreadRestrictions::SetIOAllowed(false); 43 base::ThreadRestrictions::SetIOAllowed(false);
43 base::ThreadRestrictions::DisallowWaiting(); 44 base::ThreadRestrictions::DisallowWaiting();
44 } 45 }
46 if (BrowserThread::CurrentlyOn(BrowserThread::POWER_PROFILER)) {
47 power_profiler_service_.reset(new PowerProfilerService);
pfeldman 2014/01/09 11:38:58 You should either use lazy_init, singleton or Brow
48 }
45 } 49 }
46 50
47 void BrowserProcessSubThread::CleanUp() { 51 void BrowserProcessSubThread::CleanUp() {
48 if (BrowserThread::CurrentlyOn(BrowserThread::IO)) 52 if (BrowserThread::CurrentlyOn(BrowserThread::IO))
49 IOThreadPreCleanUp(); 53 IOThreadPreCleanUp();
50 54
55 if (BrowserThread::CurrentlyOn(BrowserThread::POWER_PROFILER))
56 PowerProfilerThreadPreCleanUp();
57
51 BrowserThreadImpl::CleanUp(); 58 BrowserThreadImpl::CleanUp();
52 59
53 notification_service_.reset(); 60 notification_service_.reset();
54 61
55 #if defined(OS_WIN) 62 #if defined(OS_WIN)
56 com_initializer_.reset(); 63 com_initializer_.reset();
57 #endif 64 #endif
58 } 65 }
59 66
60 void BrowserProcessSubThread::IOThreadPreCleanUp() { 67 void BrowserProcessSubThread::IOThreadPreCleanUp() {
61 // Kill all things that might be holding onto 68 // Kill all things that might be holding onto
62 // net::URLRequest/net::URLRequestContexts. 69 // net::URLRequest/net::URLRequestContexts.
63 70
64 // Destroy all URLRequests started by URLFetchers. 71 // Destroy all URLRequests started by URLFetchers.
65 net::URLFetcher::CancelAll(); 72 net::URLFetcher::CancelAll();
66 73
67 #if !defined(OS_IOS) 74 #if !defined(OS_IOS)
68 // If any child processes are still running, terminate them and 75 // If any child processes are still running, terminate them and
69 // and delete the BrowserChildProcessHost instances to release whatever 76 // and delete the BrowserChildProcessHost instances to release whatever
70 // IO thread only resources they are referencing. 77 // IO thread only resources they are referencing.
71 BrowserChildProcessHostImpl::TerminateAll(); 78 BrowserChildProcessHostImpl::TerminateAll();
72 #endif // !defined(OS_IOS) 79 #endif // !defined(OS_IOS)
73 } 80 }
74 81
82 void BrowserProcessSubThread::PowerProfilerThreadPreCleanUp() {
83 power_profiler_service_.reset();
84 }
85
75 } // namespace content 86 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698