OLD | NEW |
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 #include <utility> | 4 #include <utility> |
5 | 5 |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/strings/pattern.h" | 10 #include "base/strings/pattern.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 explicit StringTraceDataEndpoint(CompletionCallback callback) | 27 explicit StringTraceDataEndpoint(CompletionCallback callback) |
28 : completion_callback_(callback) {} | 28 : completion_callback_(callback) {} |
29 | 29 |
30 void ReceiveTraceFinalContents( | 30 void ReceiveTraceFinalContents( |
31 scoped_ptr<const base::DictionaryValue> metadata, | 31 scoped_ptr<const base::DictionaryValue> metadata, |
32 const std::string& contents) override { | 32 const std::string& contents) override { |
33 std::string tmp = contents; | 33 std::string tmp = contents; |
34 scoped_refptr<base::RefCountedString> str = | 34 scoped_refptr<base::RefCountedString> str = |
35 base::RefCountedString::TakeString(&tmp); | 35 base::RefCountedString::TakeString(&tmp); |
36 | 36 |
37 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 37 BrowserThread::PostTask( |
38 base::Bind(completion_callback_, | 38 BrowserThread::UI, FROM_HERE, |
39 base::Passed(std::move(metadata)), str)); | 39 base::Bind(completion_callback_, base::Passed(std::move(metadata)), |
| 40 base::RetainedRef(str))); |
40 } | 41 } |
41 | 42 |
42 private: | 43 private: |
43 ~StringTraceDataEndpoint() override {} | 44 ~StringTraceDataEndpoint() override {} |
44 | 45 |
45 CompletionCallback completion_callback_; | 46 CompletionCallback completion_callback_; |
46 | 47 |
47 DISALLOW_COPY_AND_ASSIGN(StringTraceDataEndpoint); | 48 DISALLOW_COPY_AND_ASSIGN(StringTraceDataEndpoint); |
48 }; | 49 }; |
49 | 50 |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 return new StringTraceDataEndpoint(callback); | 367 return new StringTraceDataEndpoint(callback); |
367 } | 368 } |
368 | 369 |
369 scoped_refptr<TracingController::TraceDataEndpoint> | 370 scoped_refptr<TracingController::TraceDataEndpoint> |
370 TracingController::CreateFileEndpoint(const base::FilePath& file_path, | 371 TracingController::CreateFileEndpoint(const base::FilePath& file_path, |
371 const base::Closure& callback) { | 372 const base::Closure& callback) { |
372 return new FileTraceDataEndpoint(file_path, callback); | 373 return new FileTraceDataEndpoint(file_path, callback); |
373 } | 374 } |
374 | 375 |
375 } // namespace content | 376 } // namespace content |
OLD | NEW |