Skip to content

Commit

Permalink
Make //flutter/synchronization Garnet free. (flutter#5865)
Browse files Browse the repository at this point in the history
  • Loading branch information
chinmaygarde authored Jul 25, 2018
1 parent 336c23f commit 228cecc
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 35 deletions.
1 change: 0 additions & 1 deletion assets/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ source_set("assets") {
deps = [
"$flutter_root/common",
"$flutter_root/fml",
"//garnet/public/lib/fxl",
]

public_deps = [
Expand Down
6 changes: 3 additions & 3 deletions assets/zip_asset_store.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 <fcntl.h>

Expand Down Expand Up @@ -58,13 +58,13 @@ std::unique_ptr<fml::Mapping> 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;
}

Expand Down
5 changes: 2 additions & 3 deletions assets/zip_asset_store.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
#include <map>

#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 {
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion shell/common/animator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<LayerTreePipeline>(2)),
layer_tree_pipeline_(fml::MakeRefCounted<LayerTreePipeline>(2)),
pending_frame_semaphore_(1),
frame_number_(1),
paused_(false),
Expand Down
4 changes: 2 additions & 2 deletions shell/common/animator.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Animator final {

virtual void OnAnimatorDraw(
const Animator& animator,
fxl::RefPtr<flutter::Pipeline<flow::LayerTree>> pipeline) = 0;
fml::RefPtr<flutter::Pipeline<flow::LayerTree>> pipeline) = 0;

virtual void OnAnimatorDrawLastLayerTree(const Animator& animator) = 0;
};
Expand Down Expand Up @@ -68,7 +68,7 @@ class Animator final {

fxl::TimePoint last_begin_frame_time_;
int64_t dart_frame_deadline_;
fxl::RefPtr<LayerTreePipeline> layer_tree_pipeline_;
fml::RefPtr<LayerTreePipeline> layer_tree_pipeline_;
flutter::Semaphore pending_frame_semaphore_;
LayerTreePipeline::ProducerContinuation producer_continuation_;
int64_t frame_number_;
Expand Down
2 changes: 1 addition & 1 deletion shell/common/rasterizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void Rasterizer::DrawLastLayerTree() {
}

void Rasterizer::Draw(
fxl::RefPtr<flutter::Pipeline<flow::LayerTree>> pipeline) {
fml::RefPtr<flutter::Pipeline<flow::LayerTree>> pipeline) {
TRACE_EVENT0("flutter", "GPURasterizer::Draw");

flutter::Pipeline<flow::LayerTree>::Consumer consumer =
Expand Down
2 changes: 1 addition & 1 deletion shell/common/rasterizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Rasterizer final {

flow::TextureRegistry* GetTextureRegistry();

void Draw(fxl::RefPtr<flutter::Pipeline<flow::LayerTree>> pipeline);
void Draw(fml::RefPtr<flutter::Pipeline<flow::LayerTree>> pipeline);

enum class ScreenshotType {
SkiaPicture,
Expand Down
2 changes: 1 addition & 1 deletion shell/common/shell.cc
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ void Shell::OnAnimatorNotifyIdle(const Animator& animator, int64_t deadline) {
// |shell::Animator::Delegate|
void Shell::OnAnimatorDraw(
const Animator& animator,
fxl::RefPtr<flutter::Pipeline<flow::LayerTree>> pipeline) {
fml::RefPtr<flutter::Pipeline<flow::LayerTree>> pipeline) {
FXL_DCHECK(is_setup_);

task_runners_.GetGPUTaskRunner()->PostTask(
Expand Down
2 changes: 1 addition & 1 deletion shell/common/shell.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class Shell final : public PlatformView::Delegate,
// |shell::Animator::Delegate|
void OnAnimatorDraw(
const Animator& animator,
fxl::RefPtr<flutter::Pipeline<flow::LayerTree>> pipeline) override;
fml::RefPtr<flutter::Pipeline<flow::LayerTree>> pipeline) override;

// |shell::Animator::Delegate|
void OnAnimatorDrawLastLayerTree(const Animator& animator) override;
Expand Down
1 change: 0 additions & 1 deletion synchronization/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ source_set("synchronization") {

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

Expand Down
13 changes: 6 additions & 7 deletions synchronization/pipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <memory>
#include <mutex>
Expand All @@ -27,7 +26,7 @@ enum class PipelineConsumeResult {
size_t GetNextPipelineTraceID();

template <class R>
class Pipeline : public fxl::RefCountedThreadSafe<Pipeline<R>> {
class Pipeline : public fml::RefCountedThreadSafe<Pipeline<R>> {
public:
using Resource = R;
using ResourcePtr = std::unique_ptr<Resource>;
Expand Down Expand Up @@ -83,7 +82,7 @@ class Pipeline : public fxl::RefCountedThreadSafe<Pipeline<R>> {
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) {}
Expand All @@ -105,7 +104,7 @@ class Pipeline : public fxl::RefCountedThreadSafe<Pipeline<R>> {

using Consumer = std::function<void(ResourcePtr)>;

FXL_WARN_UNUSED_RESULT
FML_WARN_UNUSED_RESULT
PipelineConsumeResult Consume(Consumer consumer) {
if (consumer == nullptr) {
return PipelineConsumeResult::NoneAvailable;
Expand Down Expand Up @@ -155,7 +154,7 @@ class Pipeline : public fxl::RefCountedThreadSafe<Pipeline<R>> {
available_.Signal();
}

FXL_DISALLOW_COPY_AND_ASSIGN(Pipeline);
FML_DISALLOW_COPY_AND_ASSIGN(Pipeline);
};

} // namespace flutter
Expand Down
16 changes: 8 additions & 8 deletions synchronization/semaphore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 <dispatch/dispatch.h>
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 <semaphore.h>
#include "lib/fxl/files/eintr_wrapper.h"
#include "flutter/fml/eintr_wrapper.h"

namespace flutter {

Expand All @@ -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);
}
}

Expand All @@ -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() {
Expand All @@ -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
Expand Down
9 changes: 4 additions & 5 deletions synchronization/semaphore.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@

#include <memory>

#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 {

Expand All @@ -23,15 +22,15 @@ class Semaphore {

bool IsValid() const;

FXL_WARN_UNUSED_RESULT
FML_WARN_UNUSED_RESULT
bool TryWait();

void Signal();

private:
std::unique_ptr<PlatformSemaphore> _impl;

FXL_DISALLOW_COPY_AND_ASSIGN(Semaphore);
FML_DISALLOW_COPY_AND_ASSIGN(Semaphore);
};

} // namespace flutter
Expand Down

0 comments on commit 228cecc

Please sign in to comment.