Skip to content

Commit

Permalink
Remove fml::ThreadChecker and use the one in ftl. (flutter#3623)
Browse files Browse the repository at this point in the history
  • Loading branch information
chinmaygarde authored Apr 24, 2017
1 parent f0694bb commit 5757991
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 81 deletions.
3 changes: 0 additions & 3 deletions fml/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ source_set("fml") {
"task_runner.h",
"thread.cc",
"thread.h",
"thread_checker.cc",
"thread_checker.h",
"thread_local.h",
"trace_event.cc",
"trace_event.h",
Expand Down Expand Up @@ -105,7 +103,6 @@ executable("fml_unittests") {

sources = [
"message_loop_unittests.cc",
"thread_checker_unittests.cc",
"thread_local_unittests.cc",
"thread_unittests.cc",
]
Expand Down
17 changes: 0 additions & 17 deletions fml/thread_checker.cc

This file was deleted.

30 changes: 0 additions & 30 deletions fml/thread_checker.h

This file was deleted.

16 changes: 0 additions & 16 deletions fml/thread_checker_unittests.cc

This file was deleted.

22 changes: 13 additions & 9 deletions shell/common/shell.cc
Original file line number Diff line number Diff line change
Expand Up @@ -207,50 +207,53 @@ TracingController& Shell::tracing_controller() {
}

void Shell::InitGpuThread() {
gpu_thread_checker_.reset(new fml::ThreadChecker());
gpu_thread_checker_.reset(new ftl::ThreadChecker());
}

void Shell::InitUIThread() {
ui_thread_checker_.reset(new fml::ThreadChecker());
ui_thread_checker_.reset(new ftl::ThreadChecker());
}

void Shell::AddRasterizer(const ftl::WeakPtr<Rasterizer>& rasterizer) {
FTL_DCHECK(gpu_thread_checker_ &&
gpu_thread_checker_->IsCalledOnValidThread());
gpu_thread_checker_->IsCreationThreadCurrent());
rasterizers_.push_back(rasterizer);
}

void Shell::PurgeRasterizers() {
FTL_DCHECK(gpu_thread_checker_ &&
gpu_thread_checker_->IsCalledOnValidThread());
gpu_thread_checker_->IsCreationThreadCurrent());
rasterizers_.erase(
std::remove_if(rasterizers_.begin(), rasterizers_.end(), IsInvalid),
rasterizers_.end());
}

void Shell::GetRasterizers(std::vector<ftl::WeakPtr<Rasterizer>>* rasterizers) {
FTL_DCHECK(gpu_thread_checker_ &&
gpu_thread_checker_->IsCalledOnValidThread());
gpu_thread_checker_->IsCreationThreadCurrent());
*rasterizers = rasterizers_;
}

void Shell::AddPlatformView(const ftl::WeakPtr<PlatformView>& platform_view) {
FTL_DCHECK(ui_thread_checker_ && ui_thread_checker_->IsCalledOnValidThread());
FTL_DCHECK(ui_thread_checker_ &&
ui_thread_checker_->IsCreationThreadCurrent());
if (platform_view) {
platform_views_.push_back(platform_view);
}
}

void Shell::PurgePlatformViews() {
FTL_DCHECK(ui_thread_checker_ && ui_thread_checker_->IsCalledOnValidThread());
FTL_DCHECK(ui_thread_checker_ &&
ui_thread_checker_->IsCreationThreadCurrent());
platform_views_.erase(std::remove_if(platform_views_.begin(),
platform_views_.end(), IsViewInvalid),
platform_views_.end());
}

void Shell::GetPlatformViews(
std::vector<ftl::WeakPtr<PlatformView>>* platform_views) {
FTL_DCHECK(ui_thread_checker_ && ui_thread_checker_->IsCalledOnValidThread());
FTL_DCHECK(ui_thread_checker_ &&
ui_thread_checker_->IsCreationThreadCurrent());
*platform_views = platform_views_;
}

Expand Down Expand Up @@ -317,7 +320,8 @@ void Shell::RunInPlatformViewUIThread(uintptr_t view_id,
int64_t* dart_isolate_id,
std::string* isolate_name,
ftl::AutoResetWaitableEvent* latch) {
FTL_DCHECK(ui_thread_checker_ && ui_thread_checker_->IsCalledOnValidThread());
FTL_DCHECK(ui_thread_checker_ &&
ui_thread_checker_->IsCreationThreadCurrent());

*view_existed = false;

Expand Down
6 changes: 3 additions & 3 deletions shell/common/shell.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
#define SHELL_COMMON_SHELL_H_

#include "flutter/fml/thread.h"
#include "flutter/fml/thread_checker.h"
#include "flutter/shell/common/tracing_controller.h"
#include "lib/ftl/command_line.h"
#include "lib/ftl/macros.h"
#include "lib/ftl/memory/ref_ptr.h"
#include "lib/ftl/memory/weak_ptr.h"
#include "lib/ftl/synchronization/thread_checker.h"
#include "lib/ftl/synchronization/waitable_event.h"
#include "lib/ftl/tasks/task_runner.h"

Expand Down Expand Up @@ -95,8 +95,8 @@ class Shell {
std::unique_ptr<fml::Thread> ui_thread_;
std::unique_ptr<fml::Thread> io_thread_;

std::unique_ptr<fml::ThreadChecker> gpu_thread_checker_;
std::unique_ptr<fml::ThreadChecker> ui_thread_checker_;
std::unique_ptr<ftl::ThreadChecker> gpu_thread_checker_;
std::unique_ptr<ftl::ThreadChecker> ui_thread_checker_;

TracingController tracing_controller_;

Expand Down
3 changes: 0 additions & 3 deletions travis/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -1411,9 +1411,6 @@ FILE: ../../../flutter/fml/task_runner.cc
FILE: ../../../flutter/fml/task_runner.h
FILE: ../../../flutter/fml/thread.cc
FILE: ../../../flutter/fml/thread.h
FILE: ../../../flutter/fml/thread_checker.cc
FILE: ../../../flutter/fml/thread_checker.h
FILE: ../../../flutter/fml/thread_checker_unittests.cc
FILE: ../../../flutter/fml/thread_local.h
FILE: ../../../flutter/fml/thread_local_unittests.cc
FILE: ../../../flutter/fml/thread_unittests.cc
Expand Down

0 comments on commit 5757991

Please sign in to comment.