Fix crash when passing NULL |callback| to CefEndTracing.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1948 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2014-12-02 16:42:34 +00:00
parent b12e172af0
commit 405dd1824b
1 changed files with 10 additions and 6 deletions

View File

@ -71,6 +71,13 @@ bool CefTraceSubscriber::EndTracing(
if (!collecting_trace_data_)
return false;
if (!callback.get()) {
// Discard the trace data.
collecting_trace_data_ = false;
TracingController::GetInstance()->DisableRecording(NULL);
return true;
}
if (tracing_file.empty()) {
// Create a new temporary file path on the FILE thread, then continue.
CEF_POST_TASK(CEF_FILET,
@ -81,12 +88,9 @@ bool CefTraceSubscriber::EndTracing(
return true;
}
base::Closure result_callback;
if (callback.get()) {
result_callback =
base::Bind(&CefTraceSubscriber::OnTracingFileResult,
weak_factory_.GetWeakPtr(), callback, tracing_file);
}
base::Closure result_callback =
base::Bind(&CefTraceSubscriber::OnTracingFileResult,
weak_factory_.GetWeakPtr(), callback, tracing_file);
TracingController::GetInstance()->DisableRecording(
TracingController::CreateFileSink(tracing_file, result_callback));