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

Side by Side Diff: content/browser/tracing/power_tracing_agent.cc

Issue 1308823002: Move Singleton and related structs to namespace base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ToT Created 5 years, 3 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "base/lazy_instance.h" 5 #include "base/lazy_instance.h"
6 #include "base/memory/singleton.h" 6 #include "base/memory/singleton.h"
7 #include "base/trace_event/trace_event_impl.h" 7 #include "base/trace_event/trace_event_impl.h"
8 #include "content/browser/tracing/battor_power_trace_provider.h" 8 #include "content/browser/tracing/battor_power_trace_provider.h"
9 #include "content/browser/tracing/power_tracing_agent.h" 9 #include "content/browser/tracing/power_tracing_agent.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 void PowerTracingAgent::OnStopTracingDone( 46 void PowerTracingAgent::OnStopTracingDone(
47 const OutputCallback& callback, 47 const OutputCallback& callback,
48 const scoped_refptr<base::RefCountedString>& result) { 48 const scoped_refptr<base::RefCountedString>& result) {
49 is_tracing_ = false; 49 is_tracing_ = false;
50 // Pass the serialized events. 50 // Pass the serialized events.
51 callback.Run(result); 51 callback.Run(result);
52 } 52 }
53 53
54 // static 54 // static
55 PowerTracingAgent* PowerTracingAgent::GetInstance() { 55 PowerTracingAgent* PowerTracingAgent::GetInstance() {
56 return Singleton<PowerTracingAgent>::get(); 56 return base::Singleton<PowerTracingAgent>::get();
57 } 57 }
58 58
59 void PowerTracingAgent::FlushOnThread(const OutputCallback& callback) { 59 void PowerTracingAgent::FlushOnThread(const OutputCallback& callback) {
60 // Pass the result to the UI Thread. 60 // Pass the result to the UI Thread.
61 61
62 // TODO(prabhur) StopTracing & GetLog need to be called on a 62 // TODO(prabhur) StopTracing & GetLog need to be called on a
63 // separate thread depending on how BattorPowerTraceProvider is implemented. 63 // separate thread depending on how BattorPowerTraceProvider is implemented.
64 battor_trace_provider_->StopTracing(); 64 battor_trace_provider_->StopTracing();
65 std::string battor_logs; 65 std::string battor_logs;
66 battor_trace_provider_->GetLog(&battor_logs); 66 battor_trace_provider_->GetLog(&battor_logs);
67 scoped_refptr<base::RefCountedString> result = 67 scoped_refptr<base::RefCountedString> result =
68 base::RefCountedString::TakeString(&battor_logs); 68 base::RefCountedString::TakeString(&battor_logs);
69 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 69 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
70 base::Bind(callback, result)); 70 base::Bind(callback, result));
71 } 71 }
72 72
73 } // namespace content 73 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/tracing/power_tracing_agent.h ('k') | content/browser/webui/content_web_ui_controller_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698