Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(576)

Side by Side Diff: content/browser/tracing/tracing_controller_browsertest.cc

Issue 2143033004: Change TraceDataEndPoint::ReceiveTraceChunk() to accept unique_ptr<string> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: now use unique_ptr Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 4
5 #include "content/public/browser/tracing_controller.h" 5 #include "content/public/browser/tracing_controller.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 } // namespace 59 } // namespace
60 60
61 class TracingControllerTestEndpoint : public TraceDataEndpoint { 61 class TracingControllerTestEndpoint : public TraceDataEndpoint {
62 public: 62 public:
63 TracingControllerTestEndpoint( 63 TracingControllerTestEndpoint(
64 base::Callback<void(std::unique_ptr<const base::DictionaryValue>, 64 base::Callback<void(std::unique_ptr<const base::DictionaryValue>,
65 base::RefCountedString*)> done_callback) 65 base::RefCountedString*)> done_callback)
66 : done_callback_(done_callback) {} 66 : done_callback_(done_callback) {}
67 67
68 void ReceiveTraceChunk(const std::string& chunk) override { 68 void ReceiveTraceChunk(std::unique_ptr<std::string> chunk) override {
69 EXPECT_FALSE(chunk.empty()); 69 EXPECT_FALSE(chunk->empty());
70 trace_ += chunk; 70 trace_ += *chunk;
71 } 71 }
72 72
73 void ReceiveTraceFinalContents( 73 void ReceiveTraceFinalContents(
74 std::unique_ptr<const base::DictionaryValue> metadata) override { 74 std::unique_ptr<const base::DictionaryValue> metadata) override {
75 scoped_refptr<base::RefCountedString> chunk_ptr = 75 scoped_refptr<base::RefCountedString> chunk_ptr =
76 base::RefCountedString::TakeString(&trace_); 76 base::RefCountedString::TakeString(&trace_);
77 77
78 BrowserThread::PostTask( 78 BrowserThread::PostTask(
79 BrowserThread::UI, FROM_HERE, 79 BrowserThread::UI, FROM_HERE,
80 base::Bind(done_callback_, base::Passed(std::move(metadata)), 80 base::Bind(done_callback_, base::Passed(std::move(metadata)),
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 435
436 TracingController* controller = TracingController::GetInstance(); 436 TracingController* controller = TracingController::GetInstance();
437 EXPECT_TRUE(controller->StartTracing( 437 EXPECT_TRUE(controller->StartTracing(
438 TraceConfig(), 438 TraceConfig(),
439 TracingController::StartTracingDoneCallback())); 439 TracingController::StartTracingDoneCallback()));
440 EXPECT_TRUE(controller->StopTracing(NULL)); 440 EXPECT_TRUE(controller->StopTracing(NULL));
441 base::RunLoop().RunUntilIdle(); 441 base::RunLoop().RunUntilIdle();
442 } 442 }
443 443
444 } // namespace content 444 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698