forked from firka/flutter
Remove //base from DartController
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
|
||||
source_set("glue") {
|
||||
sources = [
|
||||
"drain_data_pipe_job.cc",
|
||||
"drain_data_pipe_job.h",
|
||||
"movable_wrapper.h",
|
||||
"stack_trace.cc",
|
||||
"stack_trace.h",
|
||||
@@ -14,5 +16,7 @@ source_set("glue") {
|
||||
|
||||
deps = [
|
||||
"//base",
|
||||
"//lib/ftl",
|
||||
"//mojo/data_pipe_utils",
|
||||
]
|
||||
}
|
||||
|
||||
43
engine/src/flutter/glue/drain_data_pipe_job.cc
Normal file
43
engine/src/flutter/glue/drain_data_pipe_job.cc
Normal file
@@ -0,0 +1,43 @@
|
||||
// Copyright 2016 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "glue/drain_data_pipe_job.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "mojo/data_pipe_utils/data_pipe_drainer.h"
|
||||
|
||||
using mojo::common::DataPipeDrainer;
|
||||
|
||||
namespace glue {
|
||||
|
||||
class DrainDataPipeJob::JobImpl : public DataPipeDrainer::Client {
|
||||
public:
|
||||
explicit JobImpl(mojo::ScopedDataPipeConsumerHandle handle,
|
||||
const ResultCallback& callback)
|
||||
: callback_(callback), drainer_(this, std::move(handle)) {}
|
||||
|
||||
private:
|
||||
// mojo::common::DataPipeDrainer::Client
|
||||
void OnDataAvailable(const void* data, size_t num_bytes) override {
|
||||
const char* bytes = static_cast<const char*>(data);
|
||||
buffer_.insert(buffer_.end(), bytes, bytes + num_bytes);
|
||||
}
|
||||
|
||||
void OnDataComplete() override { callback_(std::move(buffer_)); }
|
||||
|
||||
std::vector<char> buffer_;
|
||||
ResultCallback callback_;
|
||||
mojo::common::DataPipeDrainer drainer_;
|
||||
|
||||
FTL_DISALLOW_COPY_AND_ASSIGN(JobImpl);
|
||||
};
|
||||
|
||||
DrainDataPipeJob::DrainDataPipeJob(mojo::ScopedDataPipeConsumerHandle handle,
|
||||
const ResultCallback& callback)
|
||||
: impl_(new JobImpl(std::move(handle), callback)) {}
|
||||
|
||||
DrainDataPipeJob::~DrainDataPipeJob() {}
|
||||
|
||||
} // namespace glue
|
||||
35
engine/src/flutter/glue/drain_data_pipe_job.h
Normal file
35
engine/src/flutter/glue/drain_data_pipe_job.h
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright 2016 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef GLUE_DRAIN_DATA_PIPE_JOB_H_
|
||||
#define GLUE_DRAIN_DATA_PIPE_JOB_H_
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "lib/ftl/macros.h"
|
||||
#include "mojo/public/cpp/system/data_pipe.h"
|
||||
|
||||
namespace glue {
|
||||
|
||||
class DrainDataPipeJob {
|
||||
public:
|
||||
using ResultCallback = std::function<void(std::vector<char>)>;
|
||||
|
||||
DrainDataPipeJob(mojo::ScopedDataPipeConsumerHandle handle,
|
||||
const ResultCallback& callback);
|
||||
~DrainDataPipeJob();
|
||||
|
||||
private:
|
||||
class JobImpl;
|
||||
|
||||
std::unique_ptr<JobImpl> impl_;
|
||||
|
||||
FTL_DISALLOW_COPY_AND_ASSIGN(DrainDataPipeJob);
|
||||
};
|
||||
|
||||
} // namespace glue
|
||||
|
||||
#endif // GLUE_DRAIN_DATA_PIPE_JOB_H_
|
||||
@@ -6,6 +6,8 @@
|
||||
#define TRACE_EVENT0(a, b)
|
||||
#define TRACE_EVENT1(a, b, c, d)
|
||||
#define TRACE_EVENT2(a, b, c, d, e, f)
|
||||
#define TRACE_EVENT_ASYNC_BEGIN0(a, b, c)
|
||||
#define TRACE_EVENT_ASYNC_END0(a, b, c)
|
||||
#else
|
||||
#include "base/trace_event/trace_event.h"
|
||||
#endif // defined(__Fuchsia__)
|
||||
|
||||
Reference in New Issue
Block a user