Skip to content

Commit

Permalink
Remove incomplete static thread safety annotations. (flutter#13151)
Browse files Browse the repository at this point in the history
  • Loading branch information
chinmaygarde authored Oct 17, 2019
1 parent ee1a140 commit a925df1
Show file tree
Hide file tree
Showing 24 changed files with 30 additions and 281 deletions.
2 changes: 0 additions & 2 deletions ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,6 @@ FILE: ../../../flutter/fml/synchronization/semaphore_unittest.cc
FILE: ../../../flutter/fml/synchronization/shared_mutex.h
FILE: ../../../flutter/fml/synchronization/shared_mutex_std.cc
FILE: ../../../flutter/fml/synchronization/shared_mutex_std.h
FILE: ../../../flutter/fml/synchronization/thread_annotations.h
FILE: ../../../flutter/fml/synchronization/thread_annotations_unittest.cc
FILE: ../../../flutter/fml/synchronization/waitable_event.cc
FILE: ../../../flutter/fml/synchronization/waitable_event.h
FILE: ../../../flutter/fml/synchronization/waitable_event_unittest.cc
Expand Down
2 changes: 0 additions & 2 deletions fml/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ source_set("fml") {
"synchronization/semaphore.cc",
"synchronization/semaphore.h",
"synchronization/shared_mutex.h",
"synchronization/thread_annotations.h",
"synchronization/waitable_event.cc",
"synchronization/waitable_event.h",
"task_runner.cc",
Expand Down Expand Up @@ -212,7 +211,6 @@ executable("fml_unittests") {
"platform/darwin/string_range_sanitization_unittests.mm",
"synchronization/count_down_latch_unittests.cc",
"synchronization/semaphore_unittest.cc",
"synchronization/thread_annotations_unittest.cc",
"synchronization/waitable_event_unittest.cc",
"thread_local_unittests.cc",
"thread_unittests.cc",
Expand Down
1 change: 0 additions & 1 deletion fml/concurrent_message_loop.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

#include "flutter/fml/closure.h"
#include "flutter/fml/macros.h"
#include "flutter/fml/synchronization/thread_annotations.h"

namespace fml {

Expand Down
1 change: 0 additions & 1 deletion fml/message_loop_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "flutter/fml/memory/ref_counted.h"
#include "flutter/fml/message_loop.h"
#include "flutter/fml/message_loop_task_queues.h"
#include "flutter/fml/synchronization/thread_annotations.h"
#include "flutter/fml/time/time_point.h"
#include "flutter/fml/wakeable.h"

Expand Down
4 changes: 1 addition & 3 deletions fml/message_loop_task_queues.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include "flutter/fml/macros.h"
#include "flutter/fml/memory/ref_counted.h"
#include "flutter/fml/synchronization/shared_mutex.h"
#include "flutter/fml/synchronization/thread_annotations.h"
#include "flutter/fml/wakeable.h"

namespace fml {
Expand Down Expand Up @@ -146,8 +145,7 @@ class MessageLoopTaskQueues
fml::TimePoint GetNextWakeTimeUnlocked(TaskQueueId queue_id) const;

static std::mutex creation_mutex_;
static fml::RefPtr<MessageLoopTaskQueues> instance_
FML_GUARDED_BY(creation_mutex_);
static fml::RefPtr<MessageLoopTaskQueues> instance_;

std::unique_ptr<fml::SharedMutex> queue_meta_mutex_;
std::map<TaskQueueId, std::unique_ptr<TaskQueueEntry>> queue_entries_;
Expand Down
1 change: 1 addition & 0 deletions fml/message_loop_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <iostream>
#include <thread>

#include "flutter/fml/build_config.h"
#include "flutter/fml/concurrent_message_loop.h"
#include "flutter/fml/message_loop.h"
#include "flutter/fml/synchronization/count_down_latch.h"
Expand Down
91 changes: 0 additions & 91 deletions fml/synchronization/thread_annotations.h

This file was deleted.

127 changes: 0 additions & 127 deletions fml/synchronization/thread_annotations_unittest.cc

This file was deleted.

2 changes: 1 addition & 1 deletion fml/synchronization/waitable_event.cc
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ bool ManualResetWaitableEvent::WaitWithTimeout(TimeDelta timeout) {
// holding |mutex_|.
bool rv = WaitWithTimeoutImpl(
&locker, &cv_,
[this, last_signal_id]() FML_NO_THREAD_SAFETY_ANALYSIS {
[this, last_signal_id]() {
// Also check |signaled_| in case we're already signaled.
return signaled_ || signal_id_ != last_signal_id;
},
Expand Down
1 change: 0 additions & 1 deletion fml/synchronization/waitable_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <mutex>

#include "flutter/fml/macros.h"
#include "flutter/fml/synchronization/thread_annotations.h"
#include "flutter/fml/time/time_delta.h"

namespace fml {
Expand Down
15 changes: 5 additions & 10 deletions lib/ui/isolate_name_server/isolate_name_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <string>

#include "flutter/fml/macros.h"
#include "flutter/fml/synchronization/thread_annotations.h"
#include "third_party/dart/runtime/include/dart_api.h"

namespace flutter {
Expand All @@ -23,25 +22,21 @@ class IsolateNameServer {

// Looks up the Dart_Port associated with a given name. Returns ILLEGAL_PORT
// if the name does not exist.
Dart_Port LookupIsolatePortByName(const std::string& name)
FML_LOCKS_EXCLUDED(mutex_);
Dart_Port LookupIsolatePortByName(const std::string& name);

// Registers a Dart_Port with a given name. Returns true if registration is
// successful, false if the name entry already exists.
bool RegisterIsolatePortWithName(Dart_Port port, const std::string& name)
FML_LOCKS_EXCLUDED(mutex_);
bool RegisterIsolatePortWithName(Dart_Port port, const std::string& name);

// Removes a name to Dart_Port mapping given a name. Returns true if the
// mapping was successfully removed, false if the mapping does not exist.
bool RemoveIsolateNameMapping(const std::string& name)
FML_LOCKS_EXCLUDED(mutex_);
bool RemoveIsolateNameMapping(const std::string& name);

private:
Dart_Port LookupIsolatePortByNameUnprotected(const std::string& name)
FML_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
Dart_Port LookupIsolatePortByNameUnprotected(const std::string& name);

mutable std::mutex mutex_;
std::map<std::string, Dart_Port> port_mapping_ FML_GUARDED_BY(mutex_);
std::map<std::string, Dart_Port> port_mapping_;

FML_DISALLOW_COPY_AND_ASSIGN(IsolateNameServer);
};
Expand Down
15 changes: 6 additions & 9 deletions lib/ui/plugins/callback_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <string>

#include "flutter/fml/macros.h"
#include "flutter/fml/synchronization/thread_annotations.h"
#include "third_party/dart/runtime/include/dart_api.h"

namespace flutter {
Expand All @@ -29,28 +28,26 @@ class DartCallbackCache {

static int64_t GetCallbackHandle(const std::string& name,
const std::string& class_name,
const std::string& library_path)
FML_LOCKS_EXCLUDED(mutex_);
const std::string& library_path);

static Dart_Handle GetCallback(int64_t handle) FML_LOCKS_EXCLUDED(mutex_);
static Dart_Handle GetCallback(int64_t handle);

static std::unique_ptr<DartCallbackRepresentation> GetCallbackInformation(
int64_t handle) FML_LOCKS_EXCLUDED(mutex_);
int64_t handle);

static void LoadCacheFromDisk() FML_LOCKS_EXCLUDED(mutex_);
static void LoadCacheFromDisk();

private:
static Dart_Handle LookupDartClosure(const std::string& name,
const std::string& class_name,
const std::string& library_path);

static void SaveCacheToDisk() FML_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
static void SaveCacheToDisk();

static std::mutex mutex_;
static std::string cache_path_;

static std::map<int64_t, DartCallbackRepresentation> cache_
FML_GUARDED_BY(mutex_);
static std::map<int64_t, DartCallbackRepresentation> cache_;

FML_DISALLOW_IMPLICIT_CONSTRUCTORS(DartCallbackCache);
};
Expand Down
1 change: 0 additions & 1 deletion runtime/dart_service_isolate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ const uint8_t* GetSymbol(Dart_NativeFunction native_function) {

std::mutex DartServiceIsolate::callbacks_mutex_;

FML_GUARDED_BY(DartServiceIsolate::callbacks_mutex_)
std::set<std::unique_ptr<DartServiceIsolate::ObservatoryServerStateCallback>>
DartServiceIsolate::callbacks_;

Expand Down
Loading

0 comments on commit a925df1

Please sign in to comment.