From 228cecc293d0f9be8683933a0f4a14e91e5b9f51 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Wed, 25 Jul 2018 14:30:41 -0700 Subject: [PATCH] Make //flutter/synchronization Garnet free. (#5865) --- assets/BUILD.gn | 1 - assets/zip_asset_store.cc | 6 +++--- assets/zip_asset_store.h | 5 ++--- shell/common/animator.cc | 2 +- shell/common/animator.h | 4 ++-- shell/common/rasterizer.cc | 2 +- shell/common/rasterizer.h | 2 +- shell/common/shell.cc | 2 +- shell/common/shell.h | 2 +- synchronization/BUILD.gn | 1 - synchronization/pipeline.h | 13 ++++++------- synchronization/semaphore.cc | 16 ++++++++-------- synchronization/semaphore.h | 9 ++++----- 13 files changed, 30 insertions(+), 35 deletions(-) diff --git a/assets/BUILD.gn b/assets/BUILD.gn index febd1eda76f6c..f28e9bdd0a6ea 100644 --- a/assets/BUILD.gn +++ b/assets/BUILD.gn @@ -16,7 +16,6 @@ source_set("assets") { deps = [ "$flutter_root/common", "$flutter_root/fml", - "//garnet/public/lib/fxl", ] public_deps = [ diff --git a/assets/zip_asset_store.cc b/assets/zip_asset_store.cc index 79f0cd16eca99..7823f6e594396 100644 --- a/assets/zip_asset_store.cc +++ b/assets/zip_asset_store.cc @@ -3,7 +3,7 @@ // found in the LICENSE file. #include "flutter/assets/zip_asset_store.h" -#include "lib/fxl/build_config.h" +#include "flutter/fml/build_config.h" #include @@ -58,13 +58,13 @@ std::unique_ptr ZipAssetStore::GetAsMapping( result = unzGoToFilePos(unzipper.get(), &(found->second.file_pos)); if (result != UNZ_OK) { - FXL_LOG(WARNING) << "unzGetCurrentFileInfo failed, error=" << result; + FML_LOG(WARNING) << "unzGetCurrentFileInfo failed, error=" << result; return nullptr; } result = unzOpenCurrentFile(unzipper.get()); if (result != UNZ_OK) { - FXL_LOG(WARNING) << "unzOpenCurrentFile failed, error=" << result; + FML_LOG(WARNING) << "unzOpenCurrentFile failed, error=" << result; return nullptr; } diff --git a/assets/zip_asset_store.h b/assets/zip_asset_store.h index 0854194abe4e2..f801e0b0cca25 100644 --- a/assets/zip_asset_store.h +++ b/assets/zip_asset_store.h @@ -8,8 +8,7 @@ #include #include "flutter/assets/asset_resolver.h" -#include "lib/fxl/macros.h" -#include "lib/fxl/memory/ref_counted.h" +#include "flutter/fml/macros.h" #include "third_party/zlib/contrib/minizip/unzip.h" namespace blink { @@ -50,7 +49,7 @@ class ZipAssetStore final : public AssetResolver { UniqueUnzipper CreateUnzipper() const; - FXL_DISALLOW_COPY_AND_ASSIGN(ZipAssetStore); + FML_DISALLOW_COPY_AND_ASSIGN(ZipAssetStore); }; } // namespace blink diff --git a/shell/common/animator.cc b/shell/common/animator.cc index fe941eba80c06..d929a11e3b0dc 100644 --- a/shell/common/animator.cc +++ b/shell/common/animator.cc @@ -18,7 +18,7 @@ Animator::Animator(Delegate& delegate, waiter_(std::move(waiter)), last_begin_frame_time_(), dart_frame_deadline_(0), - layer_tree_pipeline_(fxl::MakeRefCounted(2)), + layer_tree_pipeline_(fml::MakeRefCounted(2)), pending_frame_semaphore_(1), frame_number_(1), paused_(false), diff --git a/shell/common/animator.h b/shell/common/animator.h index 8ddd852b67017..eae7b8ce3ef93 100644 --- a/shell/common/animator.h +++ b/shell/common/animator.h @@ -28,7 +28,7 @@ class Animator final { virtual void OnAnimatorDraw( const Animator& animator, - fxl::RefPtr> pipeline) = 0; + fml::RefPtr> pipeline) = 0; virtual void OnAnimatorDrawLastLayerTree(const Animator& animator) = 0; }; @@ -68,7 +68,7 @@ class Animator final { fxl::TimePoint last_begin_frame_time_; int64_t dart_frame_deadline_; - fxl::RefPtr layer_tree_pipeline_; + fml::RefPtr layer_tree_pipeline_; flutter::Semaphore pending_frame_semaphore_; LayerTreePipeline::ProducerContinuation producer_continuation_; int64_t frame_number_; diff --git a/shell/common/rasterizer.cc b/shell/common/rasterizer.cc index 998fb06160b93..862702e11c22d 100644 --- a/shell/common/rasterizer.cc +++ b/shell/common/rasterizer.cc @@ -61,7 +61,7 @@ void Rasterizer::DrawLastLayerTree() { } void Rasterizer::Draw( - fxl::RefPtr> pipeline) { + fml::RefPtr> pipeline) { TRACE_EVENT0("flutter", "GPURasterizer::Draw"); flutter::Pipeline::Consumer consumer = diff --git a/shell/common/rasterizer.h b/shell/common/rasterizer.h index 482ecbef3c587..8bb02a14f3e72 100644 --- a/shell/common/rasterizer.h +++ b/shell/common/rasterizer.h @@ -39,7 +39,7 @@ class Rasterizer final { flow::TextureRegistry* GetTextureRegistry(); - void Draw(fxl::RefPtr> pipeline); + void Draw(fml::RefPtr> pipeline); enum class ScreenshotType { SkiaPicture, diff --git a/shell/common/shell.cc b/shell/common/shell.cc index 71c066c6967db..0b1413a2c7a4b 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -695,7 +695,7 @@ void Shell::OnAnimatorNotifyIdle(const Animator& animator, int64_t deadline) { // |shell::Animator::Delegate| void Shell::OnAnimatorDraw( const Animator& animator, - fxl::RefPtr> pipeline) { + fml::RefPtr> pipeline) { FXL_DCHECK(is_setup_); task_runners_.GetGPUTaskRunner()->PostTask( diff --git a/shell/common/shell.h b/shell/common/shell.h index 4f4876734fc66..59dafe469e1be 100644 --- a/shell/common/shell.h +++ b/shell/common/shell.h @@ -181,7 +181,7 @@ class Shell final : public PlatformView::Delegate, // |shell::Animator::Delegate| void OnAnimatorDraw( const Animator& animator, - fxl::RefPtr> pipeline) override; + fml::RefPtr> pipeline) override; // |shell::Animator::Delegate| void OnAnimatorDrawLastLayerTree(const Animator& animator) override; diff --git a/synchronization/BUILD.gn b/synchronization/BUILD.gn index 72d4a45e7cdd6..258e49a182445 100644 --- a/synchronization/BUILD.gn +++ b/synchronization/BUILD.gn @@ -14,7 +14,6 @@ source_set("synchronization") { public_deps = [ "$flutter_root/fml", - "//garnet/public/lib/fxl", ] } diff --git a/synchronization/pipeline.h b/synchronization/pipeline.h index db86fac256f9d..726adf64de842 100644 --- a/synchronization/pipeline.h +++ b/synchronization/pipeline.h @@ -5,12 +5,11 @@ #ifndef SYNCHRONIZATION_PIPELINE_H_ #define SYNCHRONIZATION_PIPELINE_H_ +#include "flutter/fml/macros.h" +#include "flutter/fml/memory/ref_counted.h" #include "flutter/fml/trace_event.h" #include "flutter/synchronization/pipeline.h" #include "flutter/synchronization/semaphore.h" -#include "lib/fxl/functional/closure.h" -#include "lib/fxl/macros.h" -#include "lib/fxl/memory/ref_counted.h" #include #include @@ -27,7 +26,7 @@ enum class PipelineConsumeResult { size_t GetNextPipelineTraceID(); template -class Pipeline : public fxl::RefCountedThreadSafe> { +class Pipeline : public fml::RefCountedThreadSafe> { public: using Resource = R; using ResourcePtr = std::unique_ptr; @@ -83,7 +82,7 @@ class Pipeline : public fxl::RefCountedThreadSafe> { TRACE_EVENT_ASYNC_BEGIN0("flutter", "PipelineProduce", trace_id_); } - FXL_DISALLOW_COPY_AND_ASSIGN(ProducerContinuation); + FML_DISALLOW_COPY_AND_ASSIGN(ProducerContinuation); }; explicit Pipeline(uint32_t depth) : empty_(depth), available_(0) {} @@ -105,7 +104,7 @@ class Pipeline : public fxl::RefCountedThreadSafe> { using Consumer = std::function; - FXL_WARN_UNUSED_RESULT + FML_WARN_UNUSED_RESULT PipelineConsumeResult Consume(Consumer consumer) { if (consumer == nullptr) { return PipelineConsumeResult::NoneAvailable; @@ -155,7 +154,7 @@ class Pipeline : public fxl::RefCountedThreadSafe> { available_.Signal(); } - FXL_DISALLOW_COPY_AND_ASSIGN(Pipeline); + FML_DISALLOW_COPY_AND_ASSIGN(Pipeline); }; } // namespace flutter diff --git a/synchronization/semaphore.cc b/synchronization/semaphore.cc index 4dc5f6220e350..f3a6039b15f11 100644 --- a/synchronization/semaphore.cc +++ b/synchronization/semaphore.cc @@ -4,8 +4,8 @@ #include "flutter/synchronization/semaphore.h" -#include "lib/fxl/build_config.h" -#include "lib/fxl/logging.h" +#include "flutter/fml/build_config.h" +#include "flutter/fml/logging.h" #if OS_MACOSX #include @@ -47,7 +47,7 @@ class PlatformSemaphore { dispatch_semaphore_t _sem; const uint32_t _initial; - FXL_DISALLOW_COPY_AND_ASSIGN(PlatformSemaphore); + FML_DISALLOW_COPY_AND_ASSIGN(PlatformSemaphore); }; } // namespace flutter @@ -88,14 +88,14 @@ class PlatformSemaphore { private: HANDLE _sem; - FXL_DISALLOW_COPY_AND_ASSIGN(PlatformSemaphore); + FML_DISALLOW_COPY_AND_ASSIGN(PlatformSemaphore); }; } // namespace flutter #else #include -#include "lib/fxl/files/eintr_wrapper.h" +#include "flutter/fml/eintr_wrapper.h" namespace flutter { @@ -109,7 +109,7 @@ class PlatformSemaphore { int result = ::sem_destroy(&sem_); // Can only be EINVAL which should not be possible since we checked for // validity. - FXL_DCHECK(result == 0); + FML_DCHECK(result == 0); } } @@ -120,7 +120,7 @@ class PlatformSemaphore { return false; } - return HANDLE_EINTR(::sem_trywait(&sem_)) == 0; + return FML_HANDLE_EINTR(::sem_trywait(&sem_)) == 0; } void Signal() { @@ -137,7 +137,7 @@ class PlatformSemaphore { bool valid_; sem_t sem_; - FXL_DISALLOW_COPY_AND_ASSIGN(PlatformSemaphore); + FML_DISALLOW_COPY_AND_ASSIGN(PlatformSemaphore); }; } // namespace flutter diff --git a/synchronization/semaphore.h b/synchronization/semaphore.h index bb35957e58c8b..e2df8b3d81ad8 100644 --- a/synchronization/semaphore.h +++ b/synchronization/semaphore.h @@ -7,9 +7,8 @@ #include -#include "lib/fxl/compiler_specific.h" -#include "lib/fxl/macros.h" -#include "lib/fxl/time/time_delta.h" +#include "flutter/fml/compiler_specific.h" +#include "flutter/fml/macros.h" namespace flutter { @@ -23,7 +22,7 @@ class Semaphore { bool IsValid() const; - FXL_WARN_UNUSED_RESULT + FML_WARN_UNUSED_RESULT bool TryWait(); void Signal(); @@ -31,7 +30,7 @@ class Semaphore { private: std::unique_ptr _impl; - FXL_DISALLOW_COPY_AND_ASSIGN(Semaphore); + FML_DISALLOW_COPY_AND_ASSIGN(Semaphore); }; } // namespace flutter