summaryrefslogtreecommitdiffstats
path: root/base/debug
diff options
context:
space:
mode:
authorajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-26 16:22:50 +0000
committerajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-26 16:22:50 +0000
commit6a341fbb4fa4651ea5d60ce8aa57e5fabe3da375 (patch)
tree1062e8ae71f9d3a15421809847e6b0208bde8ad0 /base/debug
parente93fd55e815c0004672e0a7621fcd617b8196035 (diff)
downloadchromium_src-6a341fbb4fa4651ea5d60ce8aa57e5fabe3da375.zip
chromium_src-6a341fbb4fa4651ea5d60ce8aa57e5fabe3da375.tar.gz
chromium_src-6a341fbb4fa4651ea5d60ce8aa57e5fabe3da375.tar.bz2
Add COMPILE_ASSERT to ensure the result of Bind matches the Callback's type.
Required because we abstract the storage of the funciton pointer out using a reinterpret_cast to reduce template bloat. This effectively readds the failure that would have happened had we stored the function pointer directly in the template class. BUG=86008 TEST=new unittests. Review URL: http://codereview.chromium.org/7241015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90525 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/debug')
-rw-r--r--base/debug/trace_event.cc2
-rw-r--r--base/debug/trace_event.h2
-rw-r--r--base/debug/trace_event_unittest.cc5
3 files changed, 5 insertions, 4 deletions
diff --git a/base/debug/trace_event.cc b/base/debug/trace_event.cc
index 4a6cf1c..50eec0e 100644
--- a/base/debug/trace_event.cc
+++ b/base/debug/trace_event.cc
@@ -332,7 +332,7 @@ void TraceLog::Flush() {
i,
kTraceEventBatchSize,
&(json_events_str_ptr->data));
- output_callback_copy.Run(json_events_str_ptr.get());
+ output_callback_copy.Run(json_events_str_ptr);
}
}
diff --git a/base/debug/trace_event.h b/base/debug/trace_event.h
index d88e901..2162091 100644
--- a/base/debug/trace_event.h
+++ b/base/debug/trace_event.h
@@ -420,7 +420,7 @@ class BASE_API TraceLog {
// the output callback. If no callback is set, the output will be
// silently dropped. The callback must be thread safe.
typedef RefCountedData<std::string> RefCountedString;
- typedef base::Callback<void(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 a4b846e..b48260c 100644
--- a/base/debug/trace_event_unittest.cc
+++ b/base/debug/trace_event_unittest.cc
@@ -29,7 +29,8 @@ struct JsonKeyValue {
class TraceEventTestFixture : public testing::Test {
public:
void ManualTestSetUp();
- void OnTraceDataCollected(TraceLog::RefCountedString* json_events_str);
+ void OnTraceDataCollected(
+ scoped_refptr<TraceLog::RefCountedString> json_events_str);
bool FindMatchingTraceEntry(const JsonKeyValue* key_values);
bool FindNamePhase(const char* name, const char* phase);
@@ -52,7 +53,7 @@ void TraceEventTestFixture::ManualTestSetUp() {
}
void TraceEventTestFixture::OnTraceDataCollected(
- TraceLog::RefCountedString* json_events_str) {
+ scoped_refptr<TraceLog::RefCountedString> json_events_str) {
trace_string_ += json_events_str->data;
scoped_ptr<Value> root;