Skip to content

Commit

Permalink
Remove all dependencies on Garnet. (flutter#5869)
Browse files Browse the repository at this point in the history
  • Loading branch information
chinmaygarde authored Jul 26, 2018
1 parent 503ba7c commit 9f8285a
Show file tree
Hide file tree
Showing 347 changed files with 3,580 additions and 1,729 deletions.
1 change: 0 additions & 1 deletion BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ group("flutter") {
"$flutter_root/shell/platform/embedder:flutter_engine",
"$flutter_root/synchronization:synchronization_unittests",
"$flutter_root/third_party/txt:txt_unittests",
"//garnet/public/lib/fxl:fxl_unittests",
]
}
}
Expand Down
3 changes: 0 additions & 3 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,6 @@ deps = {
# build. Eventually, we'll manage these dependencies together with Fuchsia
# and not have to specific specific hashes.

'src/garnet':
Var('fuchsia_git') + '/garnet' + '@' + 'b7492b5f34e32248b164eb48ae8e67995aebda67',

'src/third_party/tonic':
Var('fuchsia_git') + '/tonic' + '@' + '57d508b12462db686573edcbc97891d90cf92f90',

Expand Down
1 change: 0 additions & 1 deletion common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ source_set("common") {

deps = [
"$flutter_root/fml",
"//garnet/public/lib/fxl",
]

public_configs = [
Expand Down
8 changes: 4 additions & 4 deletions common/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
#include <string>
#include <vector>

#include "flutter/fml/closure.h"
#include "flutter/fml/unique_fd.h"
#include "lib/fxl/functional/closure.h"

namespace blink {

using TaskObserverAdd =
std::function<void(intptr_t /* key */, fxl::Closure /* callback */)>;
std::function<void(intptr_t /* key */, fml::closure /* callback */)>;
using TaskObserverRemove = std::function<void(intptr_t /* key */)>;

struct Settings {
Expand Down Expand Up @@ -70,10 +70,10 @@ struct Settings {
TaskObserverRemove task_observer_remove;
// The main isolate is current when this callback is made. This is a good spot
// to perform native Dart bindings for libraries not built in.
fxl::Closure root_isolate_create_callback;
fml::closure root_isolate_create_callback;
// The isolate is not current and may have already been destroyed when this
// call is made.
fxl::Closure root_isolate_shutdown_callback;
fml::closure root_isolate_shutdown_callback;
bool enable_software_rendering = false;
bool skia_deterministic_rendering_on_cpu = false;
bool verbose_logging = false;
Expand Down
16 changes: 8 additions & 8 deletions common/task_runners.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
namespace blink {

TaskRunners::TaskRunners(std::string label,
fxl::RefPtr<fxl::TaskRunner> platform,
fxl::RefPtr<fxl::TaskRunner> gpu,
fxl::RefPtr<fxl::TaskRunner> ui,
fxl::RefPtr<fxl::TaskRunner> io)
fml::RefPtr<fml::TaskRunner> platform,
fml::RefPtr<fml::TaskRunner> gpu,
fml::RefPtr<fml::TaskRunner> ui,
fml::RefPtr<fml::TaskRunner> io)
: label_(std::move(label)),
platform_(std::move(platform)),
gpu_(std::move(gpu)),
Expand All @@ -25,19 +25,19 @@ const std::string& TaskRunners::GetLabel() const {
return label_;
}

fxl::RefPtr<fxl::TaskRunner> TaskRunners::GetPlatformTaskRunner() const {
fml::RefPtr<fml::TaskRunner> TaskRunners::GetPlatformTaskRunner() const {
return platform_;
}

fxl::RefPtr<fxl::TaskRunner> TaskRunners::GetUITaskRunner() const {
fml::RefPtr<fml::TaskRunner> TaskRunners::GetUITaskRunner() const {
return ui_;
}

fxl::RefPtr<fxl::TaskRunner> TaskRunners::GetIOTaskRunner() const {
fml::RefPtr<fml::TaskRunner> TaskRunners::GetIOTaskRunner() const {
return io_;
}

fxl::RefPtr<fxl::TaskRunner> TaskRunners::GetGPUTaskRunner() const {
fml::RefPtr<fml::TaskRunner> TaskRunners::GetGPUTaskRunner() const {
return gpu_;
}

Expand Down
29 changes: 15 additions & 14 deletions common/task_runners.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,41 @@

#include <string>

#include "lib/fxl/macros.h"
#include "lib/fxl/tasks/task_runner.h"
#include "flutter/fml/macros.h"
#include "flutter/fml/task_runner.h"

namespace blink {

class TaskRunners {
public:
TaskRunners(std::string label,
fxl::RefPtr<fxl::TaskRunner> platform,
fxl::RefPtr<fxl::TaskRunner> gpu,
fxl::RefPtr<fxl::TaskRunner> ui,
fxl::RefPtr<fxl::TaskRunner> io);
fml::RefPtr<fml::TaskRunner> platform,
fml::RefPtr<fml::TaskRunner> gpu,
fml::RefPtr<fml::TaskRunner> ui,
fml::RefPtr<fml::TaskRunner> io);

~TaskRunners();

const std::string& GetLabel() const;

fxl::RefPtr<fxl::TaskRunner> GetPlatformTaskRunner() const;
fml::RefPtr<fml::TaskRunner> GetPlatformTaskRunner() const;

fxl::RefPtr<fxl::TaskRunner> GetUITaskRunner() const;
fml::RefPtr<fml::TaskRunner> GetUITaskRunner() const;

fxl::RefPtr<fxl::TaskRunner> GetIOTaskRunner() const;
fml::RefPtr<fml::TaskRunner> GetIOTaskRunner() const;

fxl::RefPtr<fxl::TaskRunner> GetGPUTaskRunner() const;
fml::RefPtr<fml::TaskRunner> GetGPUTaskRunner() const;

bool IsValid() const;

private:
const std::string label_;
fxl::RefPtr<fxl::TaskRunner> platform_;
fxl::RefPtr<fxl::TaskRunner> gpu_;
fxl::RefPtr<fxl::TaskRunner> ui_;
fxl::RefPtr<fxl::TaskRunner> io_;
fml::RefPtr<fml::TaskRunner> platform_;
fml::RefPtr<fml::TaskRunner> gpu_;
fml::RefPtr<fml::TaskRunner> ui_;
fml::RefPtr<fml::TaskRunner> io_;
};

} // namespace blink

#endif // FLUTTER_COMMON_TASK_RUNNERS_H_
4 changes: 0 additions & 4 deletions flow/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ source_set("flow") {
"texture.h",
]

public_deps = [
"//garnet/public/lib/fxl",
]

public_configs = [ "$flutter_root:config" ]

deps = [
Expand Down
6 changes: 3 additions & 3 deletions flow/compositor_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "flutter/flow/instrumentation.h"
#include "flutter/flow/raster_cache.h"
#include "flutter/flow/texture.h"
#include "lib/fxl/macros.h"
#include "flutter/fml/macros.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkPictureRecorder.h"

Expand Down Expand Up @@ -44,7 +44,7 @@ class CompositorContext {
SkCanvas* canvas_;
const bool instrumentation_enabled_;

FXL_DISALLOW_COPY_AND_ASSIGN(ScopedFrame);
FML_DISALLOW_COPY_AND_ASSIGN(ScopedFrame);
};

CompositorContext();
Expand Down Expand Up @@ -81,7 +81,7 @@ class CompositorContext {

void EndFrame(ScopedFrame& frame, bool enable_instrumentation);

FXL_DISALLOW_COPY_AND_ASSIGN(CompositorContext);
FML_DISALLOW_COPY_AND_ASSIGN(CompositorContext);
};

} // namespace flow
Expand Down
2 changes: 1 addition & 1 deletion flow/debug_print.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "flutter/flow/matrix_decomposition.h"
#include "flutter/flow/raster_cache_key.h"
#include "lib/fxl/macros.h"
#include "flutter/fml/macros.h"
#include "third_party/skia/include/core/SkMatrix.h"
#include "third_party/skia/include/core/SkMatrix44.h"
#include "third_party/skia/include/core/SkPoint3.h"
Expand Down
24 changes: 12 additions & 12 deletions flow/export_node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@

#include "flutter/flow/export_node.h"

#include "lib/fxl/functional/make_copyable.h"
#include "flutter/fml/make_copyable.h"

namespace flow {

ExportNodeHolder::ExportNodeHolder(
fxl::RefPtr<fxl::TaskRunner> gpu_task_runner,
fxl::RefPtr<zircon::dart::Handle> export_token_handle)
fml::RefPtr<fml::TaskRunner> gpu_task_runner,
fml::RefPtr<zircon::dart::Handle> export_token_handle)
: gpu_task_runner_(std::move(gpu_task_runner)),
export_node_(std::make_unique<ExportNode>(export_token_handle)) {
FXL_DCHECK(gpu_task_runner_);
FML_DCHECK(gpu_task_runner_);
}

void ExportNodeHolder::Bind(SceneUpdateContext& context,
Expand All @@ -25,18 +25,18 @@ void ExportNodeHolder::Bind(SceneUpdateContext& context,

ExportNodeHolder::~ExportNodeHolder() {
gpu_task_runner_->PostTask(
fxl::MakeCopyable([export_node = std::move(export_node_)]() {
fml::MakeCopyable([export_node = std::move(export_node_)]() {
export_node->Dispose(true);
}));
}

ExportNode::ExportNode(fxl::RefPtr<zircon::dart::Handle> export_token_handle)
ExportNode::ExportNode(fml::RefPtr<zircon::dart::Handle> export_token_handle)
: export_token_(export_token_handle->ReleaseHandle()) {}

ExportNode::~ExportNode() {
// Ensure that we properly released the node.
FXL_DCHECK(!node_);
FXL_DCHECK(scene_update_context_ == nullptr);
FML_DCHECK(!node_);
FML_DCHECK(scene_update_context_ == nullptr);
}

void ExportNode::Bind(SceneUpdateContext& context,
Expand All @@ -57,9 +57,9 @@ void ExportNode::Bind(SceneUpdateContext& context,
if (node_) {
container.AddChild(*node_);
node_->SetTranslation(offset.x(), offset.y(), 0.f);
node_->SetHitTestBehavior(hit_testable
? fuchsia::ui::gfx::HitTestBehavior::kDefault
: fuchsia::ui::gfx::HitTestBehavior::kSuppress);
node_->SetHitTestBehavior(
hit_testable ? fuchsia::ui::gfx::HitTestBehavior::kDefault
: fuchsia::ui::gfx::HitTestBehavior::kSuppress);
}
}

Expand All @@ -70,7 +70,7 @@ void ExportNode::Dispose(bool remove_from_scene_update_context) {
// 1. A node was never created, or
// 2. A node was created but was already dereferenced (i.e. Dispose has
// already been called).
FXL_DCHECK(scene_update_context_ || !node_);
FML_DCHECK(scene_update_context_ || !node_);

if (remove_from_scene_update_context && scene_update_context_) {
scene_update_context_->RemoveExportNode(this);
Expand Down
24 changes: 12 additions & 12 deletions flow/export_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

#include "dart-pkg/zircon/sdk_ext/handle.h"
#include "flutter/flow/scene_update_context.h"
#include "lib/fxl/build_config.h"
#include "lib/fxl/macros.h"
#include "lib/fxl/memory/ref_counted.h"
#include "flutter/fml/build_config.h"
#include "flutter/fml/macros.h"
#include "flutter/fml/memory/ref_counted.h"
#include "lib/ui/scenic/cpp/resources.h"
#include "third_party/flutter/fml/task_runner.h"
#include "third_party/skia/include/core/SkPoint.h"
Expand All @@ -23,10 +23,10 @@ namespace flow {
// Wrapper class for ExportNode to use on UI Thread. When ExportNodeHolder is
// destroyed, a task is posted on the Rasterizer thread to dispose the resources
// held by the ExportNode.
class ExportNodeHolder : public fxl::RefCountedThreadSafe<ExportNodeHolder> {
class ExportNodeHolder : public fml::RefCountedThreadSafe<ExportNodeHolder> {
public:
ExportNodeHolder(fxl::RefPtr<fxl::TaskRunner> gpu_task_runner,
fxl::RefPtr<zircon::dart::Handle> export_token_handle);
ExportNodeHolder(fml::RefPtr<fml::TaskRunner> gpu_task_runner,
fml::RefPtr<zircon::dart::Handle> export_token_handle);
~ExportNodeHolder();

// Calls Bind() on the wrapped ExportNode.
Expand All @@ -38,20 +38,20 @@ class ExportNodeHolder : public fxl::RefCountedThreadSafe<ExportNodeHolder> {
ExportNode* export_node() { return export_node_.get(); }

private:
fxl::RefPtr<fxl::TaskRunner> gpu_task_runner_;
fml::RefPtr<fml::TaskRunner> gpu_task_runner_;
std::unique_ptr<ExportNode> export_node_;

FRIEND_MAKE_REF_COUNTED(ExportNodeHolder);
FRIEND_REF_COUNTED_THREAD_SAFE(ExportNodeHolder);
FXL_DISALLOW_COPY_AND_ASSIGN(ExportNodeHolder);
FML_FRIEND_MAKE_REF_COUNTED(ExportNodeHolder);
FML_FRIEND_REF_COUNTED_THREAD_SAFE(ExportNodeHolder);
FML_DISALLOW_COPY_AND_ASSIGN(ExportNodeHolder);
};

// Represents a node which is being exported from the session.
// This object is created on the UI thread but the entity node it contains
// must be created and destroyed by the rasterizer thread.
class ExportNode {
public:
ExportNode(fxl::RefPtr<zircon::dart::Handle> export_token_handle);
ExportNode(fml::RefPtr<zircon::dart::Handle> export_token_handle);

~ExportNode();

Expand All @@ -75,7 +75,7 @@ class ExportNode {
zx::eventpair export_token_;
std::unique_ptr<scenic::EntityNode> node_;

FXL_DISALLOW_COPY_AND_ASSIGN(ExportNode);
FML_DISALLOW_COPY_AND_ASSIGN(ExportNode);
};

} // namespace flow
Expand Down
19 changes: 9 additions & 10 deletions flow/instrumentation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,28 @@ namespace flow {
static const size_t kMaxSamples = 120;
static const size_t kMaxFrameMarkers = 8;

Stopwatch::Stopwatch() : start_(fxl::TimePoint::Now()), current_sample_(0) {
const fxl::TimeDelta delta = fxl::TimeDelta::Zero();
Stopwatch::Stopwatch() : start_(fml::TimePoint::Now()), current_sample_(0) {
const fml::TimeDelta delta = fml::TimeDelta::Zero();
laps_.resize(kMaxSamples, delta);
}

Stopwatch::~Stopwatch() = default;

void Stopwatch::Start() {
start_ = fxl::TimePoint::Now();
start_ = fml::TimePoint::Now();
current_sample_ = (current_sample_ + 1) % kMaxSamples;
}

void Stopwatch::Stop() {
laps_[current_sample_] = fxl::TimePoint::Now() - start_;
laps_[current_sample_] = fml::TimePoint::Now() - start_;
}

void Stopwatch::SetLapTime(const fxl::TimeDelta& delta) {
void Stopwatch::SetLapTime(const fml::TimeDelta& delta) {
current_sample_ = (current_sample_ + 1) % kMaxSamples;
laps_[current_sample_] = delta;
}

const fxl::TimeDelta& Stopwatch::LastLap() const {
const fml::TimeDelta& Stopwatch::LastLap() const {
return laps_[(current_sample_ - 1) % kMaxSamples];
}

Expand All @@ -51,8 +51,8 @@ static inline double UnitHeight(double frame_time_ms,
return unitHeight;
}

fxl::TimeDelta Stopwatch::MaxDelta() const {
fxl::TimeDelta max_delta;
fml::TimeDelta Stopwatch::MaxDelta() const {
fml::TimeDelta max_delta;
for (size_t i = 0; i < kMaxSamples; i++) {
if (laps_[i] > max_delta)
max_delta = laps_[i];
Expand Down Expand Up @@ -148,8 +148,7 @@ void Stopwatch::Visualize(SkCanvas& canvas, const SkRect& rect) const {
x + width * (static_cast<double>(current_sample_) / kMaxSamples);

const auto marker_rect = SkRect::MakeLTRB(
sample_x, y,
sample_x + width * sample_unit_width, bottom);
sample_x, y, sample_x + width * sample_unit_width, bottom);
canvas.drawRect(marker_rect, paint);
}

Expand Down
Loading

0 comments on commit 9f8285a

Please sign in to comment.