File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414#include " lib/fxl/build_config.h"
1515#include " lib/fxl/macros.h"
1616#include " lib/fxl/memory/ref_counted.h"
17- #include " lib/fxl/synchronization/mutex.h"
18- #include " lib/fxl/synchronization/thread_annotations.h"
1917#include " lib/ui/scenic/client/resources.h"
2018#include " third_party/skia/include/core/SkPoint.h"
2119
Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ void MessageLoopImpl::DoRun() {
9494 // should be destructed on the message loop's thread. We have just returned
9595 // from the implementations |Run| method which we know is on the correct
9696 // thread. Drop all pending tasks on the floor.
97- fxl::MutexLocker lock (& delayed_tasks_mutex_);
97+ std::lock_guard<std::mutex> lock (delayed_tasks_mutex_);
9898 delayed_tasks_ = {};
9999}
100100
@@ -111,7 +111,7 @@ void MessageLoopImpl::RegisterTask(fxl::Closure task,
111111 // |task| synchronously within this function.
112112 return ;
113113 }
114- fxl::MutexLocker lock (& delayed_tasks_mutex_);
114+ std::lock_guard<std::mutex> lock (delayed_tasks_mutex_);
115115 delayed_tasks_.push ({++order_, std::move (task), target_time});
116116 WakeUp (delayed_tasks_.top ().target_time );
117117}
@@ -121,7 +121,7 @@ void MessageLoopImpl::RunExpiredTasks() {
121121 std::vector<fxl::Closure> invocations;
122122
123123 {
124- fxl::MutexLocker lock (& delayed_tasks_mutex_);
124+ std::lock_guard<std::mutex> lock (delayed_tasks_mutex_);
125125
126126 if (delayed_tasks_.empty ()) {
127127 return ;
Original file line number Diff line number Diff line change 77
88#include < atomic>
99#include < deque>
10+ #include < mutex>
1011#include < queue>
1112#include < set>
1213#include < utility>
1516#include " lib/fxl/functional/closure.h"
1617#include " lib/fxl/macros.h"
1718#include " lib/fxl/memory/ref_counted.h"
18- #include " lib/fxl/synchronization/mutex.h"
19- #include " lib/fxl/synchronization/thread_annotations.h"
2019#include " lib/fxl/time/time_point.h"
2120
2221namespace fml {
@@ -73,9 +72,9 @@ class MessageLoopImpl : public fxl::RefCountedThreadSafe<MessageLoopImpl> {
7372 priority_queue<DelayedTask, std::deque<DelayedTask>, DelayedTaskCompare>;
7473
7574 std::set<TaskObserver*> task_observers_;
76- fxl::Mutex delayed_tasks_mutex_;
77- DelayedTaskQueue delayed_tasks_ FXL_GUARDED_BY (delayed_tasks_mutex_) ;
78- size_t order_ FXL_GUARDED_BY (delayed_tasks_mutex_) ;
75+ std::mutex delayed_tasks_mutex_;
76+ DelayedTaskQueue delayed_tasks_;
77+ size_t order_;
7978 std::atomic_bool terminated_;
8079
8180 void RegisterTask (fxl::Closure task, fxl::TimePoint target_time);
Original file line number Diff line number Diff line change 44
55#include " flutter/lib/ui/painting/resource_context.h"
66
7+ #include < mutex>
8+
79#include " lib/fxl/logging.h"
8- #include " lib/fxl/synchronization/mutex.h"
910
1011namespace blink {
1112namespace {
1213
1314static GrContext* g_context = nullptr ;
14- static fxl::Mutex g_mutex;
15+ static std::mutex g_mutex;
1516static volatile bool g_freeze = false ;
1617
1718} // namespace
1819
1920ResourceContext::ResourceContext () {
20- g_mutex.Lock ();
21+ g_mutex.lock ();
2122}
2223
2324ResourceContext::~ResourceContext () {
24- g_mutex.Unlock ();
25+ g_mutex.unlock ();
2526}
2627
2728void ResourceContext::Set (sk_sp<GrContext> context) {
@@ -38,12 +39,12 @@ std::unique_ptr<ResourceContext> ResourceContext::Acquire() {
3839}
3940
4041void ResourceContext::Freeze () {
41- fxl::MutexLocker lock (& g_mutex);
42+ std::lock_guard<std::mutex> lock (g_mutex);
4243 g_freeze = true ;
4344}
4445
4546void ResourceContext::Unfreeze () {
46- fxl::MutexLocker lock (& g_mutex);
47+ std::lock_guard<std::mutex> lock (g_mutex);
4748 g_freeze = false ;
4849}
4950
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ SkiaUnrefQueue& SkiaUnrefQueue::Get() {
2222}
2323
2424void SkiaUnrefQueue::Unref (SkRefCnt* object) {
25- fxl::MutexLocker lock (& mutex_);
25+ std::lock_guard<std::mutex> lock (mutex_);
2626 objects_.push_back (object);
2727 if (!drain_pending_) {
2828 drain_pending_ = true ;
@@ -33,7 +33,7 @@ void SkiaUnrefQueue::Unref(SkRefCnt* object) {
3333void SkiaUnrefQueue::Drain () {
3434 std::deque<SkRefCnt*> skia_objects;
3535 {
36- fxl::MutexLocker lock (& mutex_);
36+ std::lock_guard<std::mutex> lock (mutex_);
3737 objects_.swap (skia_objects);
3838 drain_pending_ = false ;
3939 }
Original file line number Diff line number Diff line change 22// Use of this source code is governed by a BSD-style license that can be
33// found in the LICENSE file.
44
5- #include " lib/fxl/synchronization/mutex.h"
65#include " third_party/skia/include/core/SkRefCnt.h"
76
7+ #include < mutex>
88#include < queue>
99
1010namespace blink {
@@ -22,9 +22,9 @@ class SkiaUnrefQueue {
2222
2323 static SkiaUnrefQueue instance_;
2424
25- fxl::Mutex mutex_;
26- std::deque<SkRefCnt*> objects_ FXL_GUARDED_BY (mutex_) ;
27- bool drain_pending_ FXL_GUARDED_BY (mutex_) ;
25+ std::mutex mutex_;
26+ std::deque<SkRefCnt*> objects_;
27+ bool drain_pending_;
2828};
2929
3030template <typename T>
Original file line number Diff line number Diff line change @@ -84,7 +84,8 @@ void Shell::InitStandalone(fxl::CommandLine command_line,
8484
8585 fml::icu::InitializeICU (icu_data_path);
8686
87- if (!command_line.HasOption (FlagForSwitch (Switch::SkiaDeterministicRendering)))
87+ if (!command_line.HasOption (
88+ FlagForSwitch (Switch::SkiaDeterministicRendering)))
8889 SkGraphics::Init ();
8990
9091 blink::Settings settings;
@@ -203,15 +204,15 @@ void Shell::AddPlatformView(PlatformView* platform_view) {
203204 if (platform_view == nullptr ) {
204205 return ;
205206 }
206- fxl::MutexLocker lock (& platform_views_mutex_);
207+ std::lock_guard<std::mutex> lock (platform_views_mutex_);
207208 platform_views_.insert (platform_view);
208209}
209210
210211void Shell::RemovePlatformView (PlatformView* platform_view) {
211212 if (platform_view == nullptr ) {
212213 return ;
213214 }
214- fxl::MutexLocker lock (& platform_views_mutex_);
215+ std::lock_guard<std::mutex> lock (platform_views_mutex_);
215216 platform_views_.erase (platform_view);
216217}
217218
@@ -220,7 +221,7 @@ void Shell::IteratePlatformViews(
220221 if (iterator == nullptr ) {
221222 return ;
222223 }
223- fxl::MutexLocker lock (& platform_views_mutex_);
224+ std::lock_guard<std::mutex> lock (platform_views_mutex_);
224225 for (PlatformView* view : platform_views_) {
225226 if (!iterator (view)) {
226227 return ;
Original file line number Diff line number Diff line change 55#ifndef SHELL_COMMON_SHELL_H_
66#define SHELL_COMMON_SHELL_H_
77
8+ #include < mutex>
89#include < unordered_set>
910
1011#include " flutter/fml/thread.h"
1415#include " lib/fxl/macros.h"
1516#include " lib/fxl/memory/ref_ptr.h"
1617#include " lib/fxl/memory/weak_ptr.h"
17- #include " lib/fxl/synchronization/mutex.h"
18- #include " lib/fxl/synchronization/thread_annotations.h"
1918#include " lib/fxl/synchronization/thread_checker.h"
2019#include " lib/fxl/synchronization/waitable_event.h"
2120#include " lib/fxl/tasks/task_runner.h"
@@ -68,9 +67,8 @@ class Shell {
6867 std::unique_ptr<fxl::ThreadChecker> gpu_thread_checker_;
6968 std::unique_ptr<fxl::ThreadChecker> ui_thread_checker_;
7069 TracingController tracing_controller_;
71- mutable fxl::Mutex platform_views_mutex_;
72- std::unordered_set<PlatformView*> platform_views_
73- FXL_GUARDED_BY (platform_views_mutex_);
70+ mutable std::mutex platform_views_mutex_;
71+ std::unordered_set<PlatformView*> platform_views_;
7472
7573 static void Init (fxl::CommandLine command_line,
7674 const std::string& bundle_path);
Original file line number Diff line number Diff line change 1111#include " lib/fxl/functional/closure.h"
1212#include " lib/fxl/macros.h"
1313#include " lib/fxl/memory/ref_counted.h"
14- #include " lib/fxl/synchronization/mutex.h"
15- #include " lib/fxl/synchronization/thread_annotations.h"
1614
1715#include < memory>
16+ #include < mutex>
1817#include < queue>
1918
2019namespace flutter {
@@ -120,7 +119,7 @@ class Pipeline : public fxl::RefCountedThreadSafe<Pipeline<R>> {
120119 size_t items_count = 0 ;
121120
122121 {
123- fxl::MutexLocker lock (& queue_mutex_);
122+ std::lock_guard<std::mutex> lock (queue_mutex_);
124123 std::tie (resource, trace_id) = std::move (queue_.front ());
125124 queue_.pop ();
126125 items_count = queue_.size ();
@@ -142,14 +141,13 @@ class Pipeline : public fxl::RefCountedThreadSafe<Pipeline<R>> {
142141 private:
143142 Semaphore empty_;
144143 Semaphore available_;
145- fxl::Mutex queue_mutex_;
146- std::queue<std::pair<ResourcePtr, size_t >> queue_
147- FXL_GUARDED_BY (queue_mutex_);
144+ std::mutex queue_mutex_;
145+ std::queue<std::pair<ResourcePtr, size_t >> queue_;
148146 std::atomic_size_t last_trace_id_;
149147
150148 void ProducerCommit (ResourcePtr resource, size_t trace_id) {
151149 {
152- fxl::MutexLocker lock (& queue_mutex_);
150+ std::lock_guard<std::mutex> lock (queue_mutex_);
153151 queue_.emplace (std::move (resource), trace_id);
154152 }
155153
You can’t perform that action at this time.
0 commit comments