diff options
author | sail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-14 21:48:54 +0000 |
---|---|---|
committer | sail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-14 21:48:54 +0000 |
commit | 115288648041898b6d50f7d2e17391e2d1972a76 (patch) | |
tree | eee67d927a7ebb40e87848924a8f26c5c5cb99ca /base/debug | |
parent | e91ac22d99252095839ca7c82c092972bd56445e (diff) | |
download | chromium_src-115288648041898b6d50f7d2e17391e2d1972a76.zip chromium_src-115288648041898b6d50f7d2e17391e2d1972a76.tar.gz chromium_src-115288648041898b6d50f7d2e17391e2d1972a76.tar.bz2 |
Revert 114494 - Remove BindStateHolder and have Bind() return a Callback<> object directly.
This removes some complexity and also fixes a bug where if you call Bind() with the result of Bind(), the resulting Callback would only be valid during the first call. Ouch.
BUG=none
TEST=new unittests
Review URL: http://codereview.chromium.org/8738001
TBR=ajwong@chromium.org
Review URL: http://codereview.chromium.org/8914022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114495 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/debug')
-rw-r--r-- | base/debug/trace_event.cc | 3 | ||||
-rw-r--r-- | base/debug/trace_event.h | 5 | ||||
-rw-r--r-- | base/debug/trace_event_unittest.cc | 4 |
3 files changed, 5 insertions, 7 deletions
diff --git a/base/debug/trace_event.cc b/base/debug/trace_event.cc index 61d3daf..5be1557 100644 --- a/base/debug/trace_event.cc +++ b/base/debug/trace_event.cc @@ -296,8 +296,7 @@ TraceResultBuffer::TraceResultBuffer() : append_comma_(false) { TraceResultBuffer::~TraceResultBuffer() { } -void TraceResultBuffer::SetOutputCallback( - const OutputCallback& json_chunk_callback) { +void TraceResultBuffer::SetOutputCallback(OutputCallback json_chunk_callback) { output_callback_ = json_chunk_callback; } diff --git a/base/debug/trace_event.h b/base/debug/trace_event.h index 621d6f06..ab56dfc 100644 --- a/base/debug/trace_event.h +++ b/base/debug/trace_event.h @@ -751,7 +751,7 @@ class BASE_EXPORT TraceResultBuffer { // JSON output and during AddFragment and Finish with following JSON output // chunks. The callback target must live past the last calls to // TraceResultBuffer::Start/AddFragment/Finish. - void SetOutputCallback(const OutputCallback& json_chunk_callback); + void SetOutputCallback(OutputCallback json_chunk_callback); // Start JSON output. This resets all internal state, so you can reuse // the TraceResultBuffer by calling Start. @@ -818,8 +818,7 @@ class BASE_EXPORT TraceLog { // undefined. Use TraceResultBuffer to convert one or more trace strings to // JSON. typedef RefCountedData<std::string> RefCountedString; - typedef base::Callback<void(const scoped_refptr<RefCountedString>&)> - OutputCallback; + typedef base::Callback<void(scoped_refptr<RefCountedString>)> OutputCallback; void SetOutputCallback(const OutputCallback& cb); // The trace buffer does not flush dynamically, so when it fills up, diff --git a/base/debug/trace_event_unittest.cc b/base/debug/trace_event_unittest.cc index 913a9d3..0ff986a 100644 --- a/base/debug/trace_event_unittest.cc +++ b/base/debug/trace_event_unittest.cc @@ -42,7 +42,7 @@ class TraceEventTestFixture : public testing::Test { // up multiple times when testing AtExit. Use ManualTestSetUp for this. void ManualTestSetUp(); void OnTraceDataCollected( - const scoped_refptr<TraceLog::RefCountedString>& events_str); + scoped_refptr<TraceLog::RefCountedString> events_str); DictionaryValue* FindMatchingTraceEntry(const JsonKeyValue* key_values); DictionaryValue* FindNamePhase(const char* name, const char* phase); DictionaryValue* FindNamePhaseKeyValue(const char* name, @@ -89,7 +89,7 @@ void TraceEventTestFixture::ManualTestSetUp() { } void TraceEventTestFixture::OnTraceDataCollected( - const scoped_refptr<TraceLog::RefCountedString>& events_str) { + scoped_refptr<TraceLog::RefCountedString> events_str) { AutoLock lock(lock_); json_output_.json_output.clear(); trace_buffer_.Start(); |