Commit d08308d6 authored by Abhijeet Kandalkar's avatar Abhijeet Kandalkar Committed by Commit Bot

Convert tracing.mojom to new Mojo types (5/n)

This CL converts |RecorderRequest| to |mojo::PendingReceiver<mojom::Recorder>|
to use new mojo types.

Bug: 955171, 978694
Change-Id: I26271b88c7742600e7c5d8dac934829681c1798d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1838771Reviewed-by: default avatarMario Sanchez Prada <mario@igalia.com>
Reviewed-by: default avatarKen Rockot <rockot@google.com>
Commit-Queue: Abhijeet Kandalkar <abhijeet@igalia.com>
Cr-Commit-Position: refs/heads/master@{#705861}
parent 1544a941
...@@ -13,14 +13,14 @@ ...@@ -13,14 +13,14 @@
namespace tracing { namespace tracing {
Recorder::Recorder(mojom::RecorderRequest request, Recorder::Recorder(mojo::PendingReceiver<mojom::Recorder> receiver,
mojom::TraceDataType data_type, mojom::TraceDataType data_type,
const base::RepeatingClosure& on_data_change_callback) const base::RepeatingClosure& on_data_change_callback)
: is_recording_(true), : is_recording_(true),
data_type_(data_type), data_type_(data_type),
on_data_change_callback_(on_data_change_callback), on_data_change_callback_(on_data_change_callback),
binding_(this, std::move(request)) { receiver_(this, std::move(receiver)) {
binding_.set_connection_error_handler(base::BindOnce( receiver_.set_disconnect_handler(base::BindOnce(
&Recorder::OnConnectionError, weak_ptr_factory_.GetWeakPtr())); &Recorder::OnConnectionError, weak_ptr_factory_.GetWeakPtr()));
} }
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/values.h" #include "base/values.h"
#include "mojo/public/cpp/bindings/binding.h" #include "mojo/public/cpp/bindings/receiver.h"
#include "services/tracing/public/mojom/tracing.mojom.h" #include "services/tracing/public/mojom/tracing.mojom.h"
namespace tracing { namespace tracing {
...@@ -32,7 +32,7 @@ class Recorder : public mojom::Recorder { ...@@ -32,7 +32,7 @@ class Recorder : public mojom::Recorder {
// |on_data_change_callback| is run whenever the recorder receives data from // |on_data_change_callback| is run whenever the recorder receives data from
// the agent or when the connection is lost to notify the tracing service of // the agent or when the connection is lost to notify the tracing service of
// the data change. // the data change.
Recorder(mojom::RecorderRequest request, Recorder(mojo::PendingReceiver<mojom::Recorder> receiver,
mojom::TraceDataType data_type, mojom::TraceDataType data_type,
const base::RepeatingClosure& on_data_change_callback); const base::RepeatingClosure& on_data_change_callback);
~Recorder() override; ~Recorder() override;
...@@ -59,7 +59,7 @@ class Recorder : public mojom::Recorder { ...@@ -59,7 +59,7 @@ class Recorder : public mojom::Recorder {
bool is_recording_; bool is_recording_;
mojom::TraceDataType data_type_; mojom::TraceDataType data_type_;
base::RepeatingClosure on_data_change_callback_; base::RepeatingClosure on_data_change_callback_;
mojo::Binding<mojom::Recorder> binding_; mojo::Receiver<mojom::Recorder> receiver_;
base::WeakPtrFactory<Recorder> weak_ptr_factory_{this}; base::WeakPtrFactory<Recorder> weak_ptr_factory_{this};
......
...@@ -33,7 +33,9 @@ class RecorderTest : public testing::Test { ...@@ -33,7 +33,9 @@ class RecorderTest : public testing::Test {
void CreateRecorder(mojom::TraceDataType data_type, void CreateRecorder(mojom::TraceDataType data_type,
const base::RepeatingClosure& callback) { const base::RepeatingClosure& callback) {
CreateRecorder(mojo::NullReceiver(), data_type, callback); mojo::PendingRemote<mojom::Recorder> dead_end_remote;
CreateRecorder(dead_end_remote.InitWithNewPipeAndPassReceiver(), data_type,
callback);
} }
void AddChunk(const std::string& chunk) { recorder_->AddChunk(chunk); } void AddChunk(const std::string& chunk) { recorder_->AddChunk(chunk); }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment