From 115288648041898b6d50f7d2e17391e2d1972a76 Mon Sep 17 00:00:00 2001 From: "sail@chromium.org" Date: Wed, 14 Dec 2011 21:48:54 +0000 Subject: 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 --- base/debug/trace_event.cc | 3 +-- base/debug/trace_event.h | 5 ++--- base/debug/trace_event_unittest.cc | 4 ++-- 3 files changed, 5 insertions(+), 7 deletions(-) (limited to 'base/debug') 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 RefCountedString; - typedef base::Callback&)> - OutputCallback; + typedef base::Callback)> 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& events_str); + scoped_refptr 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& events_str) { + scoped_refptr events_str) { AutoLock lock(lock_); json_output_.json_output.clear(); trace_buffer_.Start(); -- cgit v1.1