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

Side by Side Diff: content/browser/power_profiler/power_profiler_service.cc

Issue 332623003: [DevTools] [PowerProfiler] Fix for browser crash with active timeline recording for capturing power. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « content/browser/devtools/devtools_power_handler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/power_profiler/power_profiler_service.h" 5 #include "content/browser/power_profiler/power_profiler_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/threading/sequenced_worker_pool.h" 9 #include "base/threading/sequenced_worker_pool.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 return; 55 return;
56 56
57 observers_.AddObserver(observer); 57 observers_.AddObserver(observer);
58 if (status_ != PROFILING) 58 if (status_ != PROFILING)
59 Start(); 59 Start();
60 } 60 }
61 61
62 void PowerProfilerService::RemoveObserver(PowerProfilerObserver* observer) { 62 void PowerProfilerService::RemoveObserver(PowerProfilerObserver* observer) {
63 observers_.RemoveObserver(observer); 63 observers_.RemoveObserver(observer);
64 64
65 if (!observers_.might_have_observers()) 65 if (status_ == PROFILING && !observers_.might_have_observers())
66 Stop(); 66 Stop();
67 } 67 }
68 68
69 void PowerProfilerService::Start() { 69 void PowerProfilerService::Start() {
70 DCHECK(status_ == INITIALIZED); 70 DCHECK(status_ == INITIALIZED);
71 status_ = PROFILING; 71 status_ = PROFILING;
72 72
73 // Send out power events immediately. 73 // Send out power events immediately.
74 QueryData(); 74 QueryData();
75 75
(...skipping 24 matching lines...) Expand all
100 100
101 // Get data and notify. 101 // Get data and notify.
102 PowerEventVector events = data_provider_->GetData(); 102 PowerEventVector events = data_provider_->GetData();
103 if (events.size() != 0) { 103 if (events.size() != 0) {
104 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( 104 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(
105 &PowerProfilerService::Notify, base::Unretained(this), events)); 105 &PowerProfilerService::Notify, base::Unretained(this), events));
106 } 106 }
107 } 107 }
108 108
109 } // namespace content 109 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/devtools/devtools_power_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698