From 9ff65585860a42ca4a96db241a8a00e1f4e6159b Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Fri, 9 Nov 2018 15:10:21 -0800 Subject: [PATCH 01/11] [WIP] Fix warnings reported by chrome clang plugin https://www.chromium.org/developers/coding-style/chromium-style-checker-errors --- common/settings.cc | 3 ++ common/settings.h | 3 ++ flow/BUILD.gn | 1 + flow/embedded_views.cc | 7 +++++ flow/embedded_views.h | 2 +- flow/layers/layer_tree.cc | 2 +- flow/layers/picture_layer.cc | 2 +- flow/raster_cache.cc | 9 ++++++ flow/raster_cache.h | 7 +++-- fml/BUILD.gn | 1 + fml/file.cc | 15 +++++++++ fml/file.h | 17 ++-------- fml/logging.cc | 2 +- fml/mapping.cc | 8 +++++ fml/mapping.h | 4 +-- fml/message.cc | 4 ++- fml/message.h | 6 ++-- fml/message_loop.cc | 2 +- fml/message_loop_impl.cc | 9 ++++++ fml/message_loop_impl.h | 5 +-- fml/platform/posix/file_posix.cc | 2 +- fml/platform/posix/mapping_posix.cc | 2 +- fml/platform/posix/native_library_posix.cc | 2 +- fml/string_view.cc | 8 ++--- fml/thread_local.cc | 31 +++++++++++++++++++ fml/thread_local.h | 31 +++++-------------- .../isolate_name_server.cc | 2 ++ .../isolate_name_server/isolate_name_server.h | 2 +- 28 files changed, 128 insertions(+), 61 deletions(-) create mode 100644 flow/embedded_views.cc create mode 100644 fml/thread_local.cc diff --git a/common/settings.cc b/common/settings.cc index 620733817eb88..858ad11fefb49 100644 --- a/common/settings.cc +++ b/common/settings.cc @@ -8,6 +8,9 @@ namespace blink { +Settings::Settings() = default; +Settings::~Settings() = default; + std::string Settings::ToString() const { std::stringstream stream; stream << "Settings: " << std::endl; diff --git a/common/settings.h b/common/settings.h index c7252aa921fa3..2d686d8463c23 100644 --- a/common/settings.h +++ b/common/settings.h @@ -22,6 +22,9 @@ using TaskObserverAdd = using TaskObserverRemove = std::function; struct Settings { + Settings(); + ~Settings(); + // VM settings std::string vm_snapshot_data_path; std::string vm_snapshot_instr_path; diff --git a/flow/BUILD.gn b/flow/BUILD.gn index 5a1f50d2ee5ba..799c23caf02d3 100644 --- a/flow/BUILD.gn +++ b/flow/BUILD.gn @@ -8,6 +8,7 @@ source_set("flow") { "compositor_context.h", "debug_print.cc", "debug_print.h", + "embedded_views.cc", "embedded_views.h", "instrumentation.cc", "instrumentation.h", diff --git a/flow/embedded_views.cc b/flow/embedded_views.cc new file mode 100644 index 0000000000000..5468488036287 --- /dev/null +++ b/flow/embedded_views.cc @@ -0,0 +1,7 @@ +#include "flutter/flow/embedded_views.h" + + +namespace flow { + + bool ExternalViewEmbedder::SubmitFrame(GrContext* context) { return false; }; +} // namespace flow diff --git a/flow/embedded_views.h b/flow/embedded_views.h index 81c67de9784b5..5e8dd5814e974 100644 --- a/flow/embedded_views.h +++ b/flow/embedded_views.h @@ -37,7 +37,7 @@ class ExternalViewEmbedder { virtual SkCanvas* CompositeEmbeddedView(int view_id, const EmbeddedViewParams& params) = 0; - virtual bool SubmitFrame(GrContext* context) { return false; }; + virtual bool SubmitFrame(GrContext* context) = 0; virtual ~ExternalViewEmbedder() = default; diff --git a/flow/layers/layer_tree.cc b/flow/layers/layer_tree.cc index 19df3d27c1286..37b9b0a23b9fb 100644 --- a/flow/layers/layer_tree.cc +++ b/flow/layers/layer_tree.cc @@ -96,7 +96,7 @@ sk_sp LayerTree::Flatten(const SkRect& bounds) { TRACE_EVENT0("flutter", "LayerTree::Flatten"); SkPictureRecorder recorder; - auto canvas = recorder.beginRecording(bounds); + auto* canvas = recorder.beginRecording(bounds); if (!canvas) { return nullptr; diff --git a/flow/layers/picture_layer.cc b/flow/layers/picture_layer.cc index 74057039d304d..cef3321df4d19 100644 --- a/flow/layers/picture_layer.cc +++ b/flow/layers/picture_layer.cc @@ -15,7 +15,7 @@ PictureLayer::~PictureLayer() = default; void PictureLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) { SkPicture* sk_picture = picture(); - if (auto cache = context->raster_cache) { + if (auto* cache = context->raster_cache) { SkMatrix ctm = matrix; ctm.postTranslate(offset_.x(), offset_.y()); #ifndef SUPPORT_FRACTIONAL_TRANSLATION diff --git a/flow/raster_cache.cc b/flow/raster_cache.cc index 4de4e1e89a8a4..128605bacad8a 100644 --- a/flow/raster_cache.cc +++ b/flow/raster_cache.cc @@ -18,6 +18,15 @@ namespace flow { +RasterCacheResult::RasterCacheResult() {} + +RasterCacheResult::RasterCacheResult(const RasterCacheResult& other) = default; + +RasterCacheResult::~RasterCacheResult() = default; + +RasterCacheResult::RasterCacheResult(sk_sp image, const SkRect& logical_rect) + : image_(std::move(image)), logical_rect_(logical_rect) {} + void RasterCacheResult::draw(SkCanvas& canvas, const SkPaint* paint) const { SkAutoCanvasRestore auto_restore(&canvas, true); SkIRect bounds = diff --git a/flow/raster_cache.h b/flow/raster_cache.h index e5a081bb78100..a7894183347b0 100644 --- a/flow/raster_cache.h +++ b/flow/raster_cache.h @@ -19,10 +19,11 @@ namespace flow { class RasterCacheResult { public: - RasterCacheResult() {} + RasterCacheResult(); + RasterCacheResult(const RasterCacheResult& other); + ~RasterCacheResult(); - RasterCacheResult(sk_sp image, const SkRect& logical_rect) - : image_(std::move(image)), logical_rect_(logical_rect) {} + RasterCacheResult(sk_sp image, const SkRect& logical_rect); operator bool() const { return static_cast(image_); } diff --git a/fml/BUILD.gn b/fml/BUILD.gn index ed5cb2f1ea3f3..f73f7f40714c4 100644 --- a/fml/BUILD.gn +++ b/fml/BUILD.gn @@ -56,6 +56,7 @@ source_set("fml") { "task_runner.h", "thread.cc", "thread.h", + "thread_local.cc", "thread_local.h", "time/time_delta.h", "time/time_point.cc", diff --git a/fml/file.cc b/fml/file.cc index 1c90b2cfef7ee..8deb76c91da0f 100644 --- a/fml/file.cc +++ b/fml/file.cc @@ -43,4 +43,19 @@ fml::UniqueFD CreateDirectory(const fml::UniqueFD& base_directory, return CreateDirectory(base_directory, components, permission, 0); } +ScopedTemporaryDirectory::ScopedTemporaryDirectory() { + path_ = CreateTemporaryDirectory(); + if (path_ != "") { + dir_fd_ = OpenDirectory(path_.c_str(), false, FilePermission::kRead); + } +} + +ScopedTemporaryDirectory::~ScopedTemporaryDirectory() { + if (path_ != "") { + if (!UnlinkDirectory(path_.c_str())) { + FML_LOG(ERROR) << "Could not remove directory: " << path_; + } + } +} + } // namespace fml diff --git a/fml/file.h b/fml/file.h index a0d604f3f2c96..068ddc84c999d 100644 --- a/fml/file.h +++ b/fml/file.h @@ -75,20 +75,9 @@ bool WriteAtomically(const fml::UniqueFD& base_directory, class ScopedTemporaryDirectory { public: - ScopedTemporaryDirectory() { - path_ = CreateTemporaryDirectory(); - if (path_ != "") { - dir_fd_ = OpenDirectory(path_.c_str(), false, FilePermission::kRead); - } - } - - ~ScopedTemporaryDirectory() { - if (path_ != "") { - if (!UnlinkDirectory(path_.c_str())) { - FML_LOG(ERROR) << "Could not remove directory: " << path_; - } - } - } + ScopedTemporaryDirectory(); + + ~ScopedTemporaryDirectory(); const UniqueFD& fd() { return dir_fd_; } diff --git a/fml/logging.cc b/fml/logging.cc index 20aef13d83d80..3cf7c86964392 100644 --- a/fml/logging.cc +++ b/fml/logging.cc @@ -34,7 +34,7 @@ const char* StripDots(const char* path) { } const char* StripPath(const char* path) { - auto p = strrchr(path, '/'); + auto* p = strrchr(path, '/'); if (p) return p + 1; else diff --git a/fml/mapping.cc b/fml/mapping.cc index c3ebb60ff5b87..11882b6662bbf 100644 --- a/fml/mapping.cc +++ b/fml/mapping.cc @@ -22,4 +22,12 @@ const uint8_t* DataMapping::GetMapping() const { return data_.data(); } +size_t NonOwnedMapping::GetSize() const { + return size_; +} + +const uint8_t* NonOwnedMapping::GetMapping() const { + return data_; +} + } // namespace fml diff --git a/fml/mapping.h b/fml/mapping.h index 7d16366c5f19c..05894a5c219a4 100644 --- a/fml/mapping.h +++ b/fml/mapping.h @@ -84,9 +84,9 @@ class NonOwnedMapping : public Mapping { NonOwnedMapping(const uint8_t* data, size_t size) : data_(data), size_(size) {} - size_t GetSize() const override { return size_; } + size_t GetSize() const override; - const uint8_t* GetMapping() const override { return data_; } + const uint8_t* GetMapping() const override; private: const uint8_t* const data_; diff --git a/fml/message.cc b/fml/message.cc index c5c3682ba5626..acf48e4bd2195 100644 --- a/fml/message.cc +++ b/fml/message.cc @@ -8,6 +8,8 @@ namespace fml { +size_t MessageSerializable::GetSerializableTag() const { return 0; }; + Message::Message() = default; Message::~Message() = default; @@ -96,7 +98,7 @@ uint8_t* Message::PrepareDecode(size_t size) { if ((size + size_read_) > buffer_length_) { return nullptr; } - auto buffer = buffer_ + size_read_; + auto* buffer = buffer_ + size_read_; size_read_ += size; return buffer; } diff --git a/fml/message.h b/fml/message.h index 8d7e63a2e7896..b291228da0885 100644 --- a/fml/message.h +++ b/fml/message.h @@ -47,7 +47,7 @@ class MessageSerializable { virtual bool Deserialize(Message& message) = 0; - virtual size_t GetSerializableTag() const { return 0; }; + virtual size_t GetSerializableTag() const = 0; }; // The traits passed to the encode/decode calls that accept traits should be @@ -88,7 +88,7 @@ class Message { template ::value>> FML_WARN_UNUSED_RESULT bool Encode(const T& value) { - if (auto buffer = PrepareEncode(sizeof(T))) { + if (auto* buffer = PrepareEncode(sizeof(T))) { ::memcpy(buffer, &value, sizeof(T)); return true; } @@ -131,7 +131,7 @@ class Message { template ::value>> FML_WARN_UNUSED_RESULT bool Decode(T& value) { - if (auto buffer = PrepareDecode(sizeof(T))) { + if (auto* buffer = PrepareDecode(sizeof(T))) { ::memcpy(&value, buffer, sizeof(T)); return true; } diff --git a/fml/message_loop.cc b/fml/message_loop.cc index 3238e6f443742..469d47207566a 100644 --- a/fml/message_loop.cc +++ b/fml/message_loop.cc @@ -19,7 +19,7 @@ FML_THREAD_LOCAL ThreadLocal tls_message_loop([](intptr_t value) { }); MessageLoop& MessageLoop::GetCurrent() { - auto loop = reinterpret_cast(tls_message_loop.Get()); + auto* loop = reinterpret_cast(tls_message_loop.Get()); FML_CHECK(loop != nullptr) << "MessageLoop::EnsureInitializedForCurrentThread was not called on " "this thread prior to message loop use."; diff --git a/fml/message_loop_impl.cc b/fml/message_loop_impl.cc index 6c5024a9a25de..f38a525ecaaec 100644 --- a/fml/message_loop_impl.cc +++ b/fml/message_loop_impl.cc @@ -145,4 +145,13 @@ void MessageLoopImpl::RunExpiredTasks() { } } +MessageLoopImpl::DelayedTask::DelayedTask(size_t p_order, + fml::closure p_task, + fml::TimePoint p_target_time) + : order(p_order), task(std::move(p_task)), target_time(p_target_time) {} + +MessageLoopImpl::DelayedTask::DelayedTask(const DelayedTask& other) = default; + +MessageLoopImpl::DelayedTask::~DelayedTask() = default; + } // namespace fml diff --git a/fml/message_loop_impl.h b/fml/message_loop_impl.h index de1c4147081fe..15def86a0ec59 100644 --- a/fml/message_loop_impl.h +++ b/fml/message_loop_impl.h @@ -57,8 +57,9 @@ class MessageLoopImpl : public fml::RefCountedThreadSafe { DelayedTask(size_t p_order, fml::closure p_task, - fml::TimePoint p_target_time) - : order(p_order), task(std::move(p_task)), target_time(p_target_time) {} + fml::TimePoint p_target_time); + DelayedTask(const DelayedTask& other); + ~DelayedTask(); }; struct DelayedTaskCompare { diff --git a/fml/platform/posix/file_posix.cc b/fml/platform/posix/file_posix.cc index c6911bd0489d3..d30a9c2f1d2df 100644 --- a/fml/platform/posix/file_posix.cc +++ b/fml/platform/posix/file_posix.cc @@ -19,7 +19,7 @@ namespace fml { std::string CreateTemporaryDirectory() { char directory_name[] = "/tmp/flutter_XXXXXXXX"; - auto result = ::mkdtemp(directory_name); + auto* result = ::mkdtemp(directory_name); if (result == nullptr) { return ""; } diff --git a/fml/platform/posix/mapping_posix.cc b/fml/platform/posix/mapping_posix.cc index 670b3873303b4..bc5adbd107544 100644 --- a/fml/platform/posix/mapping_posix.cc +++ b/fml/platform/posix/mapping_posix.cc @@ -69,7 +69,7 @@ FileMapping::FileMapping(const fml::UniqueFD& handle, const auto is_writable = IsWritable(protection); - auto mapping = + auto* mapping = ::mmap(nullptr, stat_buffer.st_size, ToPosixProtectionFlags(protection), is_writable ? MAP_SHARED : MAP_PRIVATE, handle.get(), 0); diff --git a/fml/platform/posix/native_library_posix.cc b/fml/platform/posix/native_library_posix.cc index 9d10152848ec8..558061e739673 100644 --- a/fml/platform/posix/native_library_posix.cc +++ b/fml/platform/posix/native_library_posix.cc @@ -58,7 +58,7 @@ fml::RefPtr NativeLibrary::CreateForCurrentProcess() { } const uint8_t* NativeLibrary::ResolveSymbol(const char* symbol) { - auto resolved_symbol = static_cast(::dlsym(handle_, symbol)); + auto* resolved_symbol = static_cast(::dlsym(handle_, symbol)); if (resolved_symbol == nullptr) { FML_DLOG(INFO) << "Could not resolve symbol in library: " << symbol; } diff --git a/fml/string_view.cc b/fml/string_view.cc index bca1452b82e19..5f217c439f50c 100644 --- a/fml/string_view.cc +++ b/fml/string_view.cc @@ -84,7 +84,7 @@ size_t StringView::find(StringView s, size_t pos) const { if (s.empty()) return pos; - auto result = std::search(begin() + pos, end(), s.begin(), s.end()); + auto* result = std::search(begin() + pos, end(), s.begin(), s.end()); if (result == end()) return npos; return result - begin(); @@ -94,7 +94,7 @@ size_t StringView::find(char c, size_t pos) const { if (pos > size_) return npos; - auto result = std::find(begin() + pos, end(), c); + auto* result = std::find(begin() + pos, end(), c); if (result == end()) return npos; return result - begin(); @@ -106,8 +106,8 @@ size_t StringView::rfind(StringView s, size_t pos) const { if (s.empty()) return std::min(pos, size_); - auto last = begin() + std::min(size_ - s.size(), pos) + s.size(); - auto result = std::find_end(begin(), last, s.begin(), s.end()); + auto* last = begin() + std::min(size_ - s.size(), pos) + s.size(); + auto* result = std::find_end(begin(), last, s.begin(), s.end()); if (result == last) return npos; return result - begin(); diff --git a/fml/thread_local.cc b/fml/thread_local.cc new file mode 100644 index 0000000000000..b9561bbcf051e --- /dev/null +++ b/fml/thread_local.cc @@ -0,0 +1,31 @@ +#include "flutter/fml/thread_local.h" + +namespace fml { + +ThreadLocal::ThreadLocal() : ThreadLocal(nullptr) {} + +ThreadLocal::ThreadLocal(ThreadLocalDestroyCallback destroy) : destroy_(destroy) { + auto callback = + reinterpret_cast(&ThreadLocal::ThreadLocalDestroy); + FML_CHECK(pthread_key_create(&_key, callback) == 0); +} + +ThreadLocal::~ThreadLocal() { + // This will NOT call the destroy callbacks on thread local values still + // active in other threads. Those must be cleared manually. The usage + // of this class should be similar to the thread_local keyword but with + // with a static storage specifier + + // Collect the container + delete reinterpret_cast(pthread_getspecific(_key)); + + // Finally, collect the key + FML_CHECK(pthread_key_delete(_key) == 0); +} + +ThreadLocal::Box::Box(ThreadLocalDestroyCallback destroy, intptr_t value) + : destroy_(destroy), value_(value) {} + +ThreadLocal::Box::~Box() = default; + +} diff --git a/fml/thread_local.h b/fml/thread_local.h index daff25bac1155..49347f104173a 100644 --- a/fml/thread_local.h +++ b/fml/thread_local.h @@ -31,8 +31,8 @@ class ThreadLocal { private: class Box { public: - Box(ThreadLocalDestroyCallback destroy, intptr_t value) - : destroy_(destroy), value_(value) {} + Box(ThreadLocalDestroyCallback destroy, intptr_t value); + ~Box(); intptr_t Value() const { return value_; } @@ -60,22 +60,18 @@ class ThreadLocal { static inline void ThreadLocalDestroy(void* value) { FML_CHECK(value != nullptr); - auto box = reinterpret_cast(value); + auto* box = reinterpret_cast(value); box->DestroyValue(); delete box; } public: - ThreadLocal() : ThreadLocal(nullptr) {} + ThreadLocal(); - ThreadLocal(ThreadLocalDestroyCallback destroy) : destroy_(destroy) { - auto callback = - reinterpret_cast(&ThreadLocal::ThreadLocalDestroy); - FML_CHECK(pthread_key_create(&_key, callback) == 0); - } + ThreadLocal(ThreadLocalDestroyCallback destroy); void Set(intptr_t value) { - auto box = reinterpret_cast(pthread_getspecific(_key)); + auto* box = reinterpret_cast(pthread_getspecific(_key)); if (box == nullptr) { box = new Box(destroy_, value); FML_CHECK(pthread_setspecific(_key, box) == 0); @@ -85,22 +81,11 @@ class ThreadLocal { } intptr_t Get() { - auto box = reinterpret_cast(pthread_getspecific(_key)); + auto* box = reinterpret_cast(pthread_getspecific(_key)); return box != nullptr ? box->Value() : 0; } - ~ThreadLocal() { - // This will NOT call the destroy callbacks on thread local values still - // active in other threads. Those must be cleared manually. The usage - // of this class should be similar to the thread_local keyword but with - // with a static storage specifier - - // Collect the container - delete reinterpret_cast(pthread_getspecific(_key)); - - // Finally, collect the key - FML_CHECK(pthread_key_delete(_key) == 0); - } + ~ThreadLocal(); private: pthread_key_t _key; diff --git a/lib/ui/isolate_name_server/isolate_name_server.cc b/lib/ui/isolate_name_server/isolate_name_server.cc index 0fe928e7e1df2..5445d2a4d98a4 100644 --- a/lib/ui/isolate_name_server/isolate_name_server.cc +++ b/lib/ui/isolate_name_server/isolate_name_server.cc @@ -6,6 +6,8 @@ namespace blink { +IsolateNameServer::IsolateNameServer() {} + Dart_Port IsolateNameServer::LookupIsolatePortByName(const std::string& name) { std::lock_guard lock(mutex_); return LookupIsolatePortByNameUnprotected(name); diff --git a/lib/ui/isolate_name_server/isolate_name_server.h b/lib/ui/isolate_name_server/isolate_name_server.h index 97c44d5cd47b4..73aee74d2764d 100644 --- a/lib/ui/isolate_name_server/isolate_name_server.h +++ b/lib/ui/isolate_name_server/isolate_name_server.h @@ -17,7 +17,7 @@ namespace blink { class IsolateNameServer { public: - IsolateNameServer() {} + IsolateNameServer(); // Looks up the Dart_Port associated with a given name. Returns ILLEGAL_PORT // if the name does not exist. From bfb09d7f497a3f0bbfc3019da3f5e30c6367b0c0 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Fri, 9 Nov 2018 16:29:07 -0800 Subject: [PATCH 02/11] lib/ui fixed --- assets/asset_manager.h | 2 +- common/task_runners.cc | 2 ++ common/task_runners.h | 2 ++ lib/ui/compositing/scene.cc | 4 ++-- .../isolate_name_server.cc | 2 ++ .../isolate_name_server/isolate_name_server.h | 1 + lib/ui/painting/codec.cc | 18 ++++++++++++++-- lib/ui/painting/codec.h | 21 ++++++++++--------- lib/ui/painting/engine_layer.cc | 3 +++ lib/ui/painting/engine_layer.h | 3 +-- lib/ui/painting/frame_info.cc | 4 ++++ lib/ui/painting/frame_info.h | 5 ++--- lib/ui/painting/image.h | 2 +- lib/ui/painting/picture.h | 2 +- lib/ui/painting/picture_recorder.h | 2 +- lib/ui/plugins/callback_cache.cc | 2 +- lib/ui/text/asset_manager_font_provider.cc | 5 +++++ lib/ui/text/asset_manager_font_provider.h | 4 +++- lib/ui/text/paragraph.h | 2 +- lib/ui/ui_dart_state.h | 2 +- 20 files changed, 61 insertions(+), 27 deletions(-) diff --git a/assets/asset_manager.h b/assets/asset_manager.h index 84ae784f66573..42ffa9b1053c4 100644 --- a/assets/asset_manager.h +++ b/assets/asset_manager.h @@ -19,7 +19,7 @@ class AssetManager final : public AssetResolver { public: AssetManager(); - ~AssetManager(); + ~AssetManager() override; void PushFront(std::unique_ptr resolver); diff --git a/common/task_runners.cc b/common/task_runners.cc index f9d251460e1a0..d76bc20f6ae38 100644 --- a/common/task_runners.cc +++ b/common/task_runners.cc @@ -19,6 +19,8 @@ TaskRunners::TaskRunners(std::string label, ui_(std::move(ui)), io_(std::move(io)) {} +TaskRunners::TaskRunners(const TaskRunners& other) = default; + TaskRunners::~TaskRunners() = default; const std::string& TaskRunners::GetLabel() const { diff --git a/common/task_runners.h b/common/task_runners.h index aca38bebaa227..0bd0c301903ae 100644 --- a/common/task_runners.h +++ b/common/task_runners.h @@ -20,6 +20,8 @@ class TaskRunners { fml::RefPtr ui, fml::RefPtr io); + TaskRunners(const TaskRunners& other); + ~TaskRunners(); const std::string& GetLabel() const; diff --git a/lib/ui/compositing/scene.cc b/lib/ui/compositing/scene.cc index 2dea867733e25..8d3537750f5fa 100644 --- a/lib/ui/compositing/scene.cc +++ b/lib/ui/compositing/scene.cc @@ -69,7 +69,7 @@ Dart_Handle Scene::toImage(uint32_t width, return tonic::ToDart("Image dimensions for scene were invalid."); } - auto dart_state = UIDartState::Current(); + auto* dart_state = UIDartState::Current(); auto image_callback = std::make_unique( dart_state, raw_image_callback); auto unref_queue = dart_state->GetSkiaUnrefQueue(); @@ -114,7 +114,7 @@ Dart_Handle Scene::toImage(uint32_t width, auto dart_image = CanvasImage::Create(); dart_image->set_image({std::move(raster_image), std::move(unref_queue)}); - auto raw_dart_image = tonic::ToDart(std::move(dart_image)); + auto* raw_dart_image = tonic::ToDart(std::move(dart_image)); // All done! tonic::DartInvoke(image_callback->Get(), {raw_dart_image}); diff --git a/lib/ui/isolate_name_server/isolate_name_server.cc b/lib/ui/isolate_name_server/isolate_name_server.cc index 5445d2a4d98a4..deae4fe6f8f16 100644 --- a/lib/ui/isolate_name_server/isolate_name_server.cc +++ b/lib/ui/isolate_name_server/isolate_name_server.cc @@ -8,6 +8,8 @@ namespace blink { IsolateNameServer::IsolateNameServer() {} +IsolateNameServer::~IsolateNameServer() = default; + Dart_Port IsolateNameServer::LookupIsolatePortByName(const std::string& name) { std::lock_guard lock(mutex_); return LookupIsolatePortByNameUnprotected(name); diff --git a/lib/ui/isolate_name_server/isolate_name_server.h b/lib/ui/isolate_name_server/isolate_name_server.h index 73aee74d2764d..aa8a7e0f0590e 100644 --- a/lib/ui/isolate_name_server/isolate_name_server.h +++ b/lib/ui/isolate_name_server/isolate_name_server.h @@ -18,6 +18,7 @@ namespace blink { class IsolateNameServer { public: IsolateNameServer(); + ~IsolateNameServer(); // Looks up the Dart_Port associated with a given name. Returns ILLEGAL_PORT // if the name does not exist. diff --git a/lib/ui/painting/codec.cc b/lib/ui/painting/codec.cc index 608d332f673d5..73ae0d170f5b4 100644 --- a/lib/ui/painting/codec.cc +++ b/lib/ui/painting/codec.cc @@ -283,7 +283,7 @@ void InstantiateImageCodec(Dart_NativeArguments args) { auto buffer = SkData::MakeWithCopy(list.data(), list.num_elements()); - auto dart_state = UIDartState::Current(); + auto* dart_state = UIDartState::Current(); const auto& task_runners = dart_state->GetTaskRunners(); task_runners.GetIOTaskRunner()->PostTask(fml::MakeCopyable( @@ -387,6 +387,11 @@ MultiFrameCodec::MultiFrameCodec(std::unique_ptr codec, nextFrameIndex_ = 0; } +MultiFrameCodec::~MultiFrameCodec() {} + +int MultiFrameCodec::frameCount() { return frameInfos_.size(); } +int MultiFrameCodec::repetitionCount() { return repetitionCount_; } + sk_sp MultiFrameCodec::GetNextFrameImage( fml::WeakPtr resourceContext) { // Populate this bitmap from the cache if it exists @@ -481,7 +486,7 @@ Dart_Handle MultiFrameCodec::getNextFrame(Dart_Handle callback_handle) { return ToDart("Callback must be a function"); } - auto dart_state = UIDartState::Current(); + auto* dart_state = UIDartState::Current(); const auto& task_runners = dart_state->GetTaskRunners(); @@ -499,6 +504,15 @@ Dart_Handle MultiFrameCodec::getNextFrame(Dart_Handle callback_handle) { return Dart_Null(); } +MultiFrameCodec::DecodedFrame::DecodedFrame(bool required) : required_(required) {} +MultiFrameCodec::DecodedFrame::~DecodedFrame() = default; + +SingleFrameCodec::SingleFrameCodec(fml::RefPtr frame) : frame_(std::move(frame)) {} +SingleFrameCodec::~SingleFrameCodec() {} + +int SingleFrameCodec::frameCount() { return 1; } +int SingleFrameCodec::repetitionCount() { return 0; } + Dart_Handle SingleFrameCodec::getNextFrame(Dart_Handle callback_handle) { if (!Dart_IsClosure(callback_handle)) { return ToDart("Callback must be a function"); diff --git a/lib/ui/painting/codec.h b/lib/ui/painting/codec.h index 4a61d328a828e..e853556e2b4ac 100644 --- a/lib/ui/painting/codec.h +++ b/lib/ui/painting/codec.h @@ -36,15 +36,15 @@ class Codec : public RefCountedDartWrappable { class MultiFrameCodec : public Codec { public: - int frameCount() { return frameInfos_.size(); } - int repetitionCount() { return repetitionCount_; } - Dart_Handle getNextFrame(Dart_Handle args); + int frameCount() override; + int repetitionCount() override; + Dart_Handle getNextFrame(Dart_Handle args) override; private: MultiFrameCodec(std::unique_ptr codec, const float decodedCacheRatioCap); - ~MultiFrameCodec() {} + ~MultiFrameCodec() override; sk_sp GetNextFrameImage(fml::WeakPtr resourceContext); @@ -71,7 +71,8 @@ class MultiFrameCodec : public Codec { std::unique_ptr bitmap_ = nullptr; const bool required_; - DecodedFrame(bool required) : required_(required) {} + DecodedFrame(bool required); + ~DecodedFrame(); }; // A cache of previously loaded bitmaps, indexed by the frame they belong to. @@ -86,13 +87,13 @@ class MultiFrameCodec : public Codec { class SingleFrameCodec : public Codec { public: - int frameCount() { return 1; } - int repetitionCount() { return 0; } - Dart_Handle getNextFrame(Dart_Handle args); + int frameCount() override; + int repetitionCount() override; + Dart_Handle getNextFrame(Dart_Handle args) override; private: - SingleFrameCodec(fml::RefPtr frame) : frame_(std::move(frame)) {} - ~SingleFrameCodec() {} + SingleFrameCodec(fml::RefPtr frame); + ~SingleFrameCodec() override; fml::RefPtr frame_; diff --git a/lib/ui/painting/engine_layer.cc b/lib/ui/painting/engine_layer.cc index f5afb9fde0b43..416b1549b115a 100644 --- a/lib/ui/painting/engine_layer.cc +++ b/lib/ui/painting/engine_layer.cc @@ -15,6 +15,9 @@ using tonic::ToDart; namespace blink { +EngineLayer::EngineLayer(std::shared_ptr layer) + : layer_(layer) {} + EngineLayer::~EngineLayer() = default; size_t EngineLayer::GetAllocationSize() { diff --git a/lib/ui/painting/engine_layer.h b/lib/ui/painting/engine_layer.h index 0f1e32bd77ca1..a95e58a9e2e6a 100644 --- a/lib/ui/painting/engine_layer.h +++ b/lib/ui/painting/engine_layer.h @@ -35,8 +35,7 @@ class EngineLayer : public RefCountedDartWrappable { std::shared_ptr Layer() const { return layer_; } private: - explicit EngineLayer(std::shared_ptr layer) - : layer_(layer) {} + explicit EngineLayer(std::shared_ptr layer); std::shared_ptr layer_; FML_FRIEND_MAKE_REF_COUNTED(EngineLayer); diff --git a/lib/ui/painting/frame_info.cc b/lib/ui/painting/frame_info.cc index 123fc955efccf..07d36ba968d74 100644 --- a/lib/ui/painting/frame_info.cc +++ b/lib/ui/painting/frame_info.cc @@ -18,6 +18,10 @@ IMPLEMENT_WRAPPERTYPEINFO(ui, FrameInfo); FOR_EACH_BINDING(DART_NATIVE_CALLBACK) +FrameInfo::FrameInfo(fml::RefPtr image, int durationMillis) + : image_(std::move(image)), durationMillis_(durationMillis) {} +FrameInfo::~FrameInfo() {}; + void FrameInfo::RegisterNatives(tonic::DartLibraryNatives* natives) { natives->Register({FOR_EACH_BINDING(DART_REGISTER_NATIVE)}); } diff --git a/lib/ui/painting/frame_info.h b/lib/ui/painting/frame_info.h index 15a663dab8a7c..1a3ed5f6b90cf 100644 --- a/lib/ui/painting/frame_info.h +++ b/lib/ui/painting/frame_info.h @@ -25,9 +25,8 @@ class FrameInfo final : public RefCountedDartWrappable { static void RegisterNatives(tonic::DartLibraryNatives* natives); private: - FrameInfo(fml::RefPtr image, int durationMillis) - : image_(std::move(image)), durationMillis_(durationMillis) {} - ~FrameInfo(){}; + FrameInfo(fml::RefPtr image, int durationMillis); + ~FrameInfo() override; const fml::RefPtr image_; const int durationMillis_; diff --git a/lib/ui/painting/image.h b/lib/ui/painting/image.h index 51b24df128e62..a2db734b57516 100644 --- a/lib/ui/painting/image.h +++ b/lib/ui/painting/image.h @@ -39,7 +39,7 @@ class CanvasImage final : public RefCountedDartWrappable { image_ = std::move(image); } - virtual size_t GetAllocationSize() override; + size_t GetAllocationSize() override; static void RegisterNatives(tonic::DartLibraryNatives* natives); diff --git a/lib/ui/painting/picture.h b/lib/ui/painting/picture.h index b7b42acba206d..c95afd30f1f75 100644 --- a/lib/ui/painting/picture.h +++ b/lib/ui/painting/picture.h @@ -31,7 +31,7 @@ class Picture : public RefCountedDartWrappable { void dispose(); - virtual size_t GetAllocationSize() override; + size_t GetAllocationSize() override; static void RegisterNatives(tonic::DartLibraryNatives* natives); diff --git a/lib/ui/painting/picture_recorder.h b/lib/ui/painting/picture_recorder.h index f2842ae4a966d..90e5a4c03f365 100644 --- a/lib/ui/painting/picture_recorder.h +++ b/lib/ui/painting/picture_recorder.h @@ -23,7 +23,7 @@ class PictureRecorder : public RefCountedDartWrappable { public: static fml::RefPtr Create(); - ~PictureRecorder(); + ~PictureRecorder() override; SkCanvas* BeginRecording(SkRect bounds); fml::RefPtr endRecording(); diff --git a/lib/ui/plugins/callback_cache.cc b/lib/ui/plugins/callback_cache.cc index 94cb981dc5556..b2d4cc0d72d44 100644 --- a/lib/ui/plugins/callback_cache.cc +++ b/lib/ui/plugins/callback_cache.cc @@ -134,7 +134,7 @@ void DartCallbackCache::LoadCacheFromDisk() { return; } const auto entries = d.GetArray(); - for (auto it = entries.begin(); it != entries.end(); ++it) { + for (auto* it = entries.begin(); it != entries.end(); ++it) { const auto root_obj = it->GetObject(); const auto representation = root_obj[kRepresentationKey].GetObject(); diff --git a/lib/ui/text/asset_manager_font_provider.cc b/lib/ui/text/asset_manager_font_provider.cc index 3147573404871..ba2713c60d23b 100644 --- a/lib/ui/text/asset_manager_font_provider.cc +++ b/lib/ui/text/asset_manager_font_provider.cc @@ -123,4 +123,9 @@ SkTypeface* AssetManagerFontStyleSet::matchStyle(const SkFontStyle& pattern) { return SkRef(assets_[0].typeface.get()); } + AssetManagerFontStyleSet::TypefaceAsset::TypefaceAsset(std::string a) : asset(std::move(a)) {} + AssetManagerFontStyleSet::TypefaceAsset::TypefaceAsset(const AssetManagerFontStyleSet::TypefaceAsset& other) = default; + + AssetManagerFontStyleSet::TypefaceAsset::~TypefaceAsset() = default; + } // namespace blink diff --git a/lib/ui/text/asset_manager_font_provider.h b/lib/ui/text/asset_manager_font_provider.h index 785ff66700907..ef414bc2c5582 100644 --- a/lib/ui/text/asset_manager_font_provider.h +++ b/lib/ui/text/asset_manager_font_provider.h @@ -42,7 +42,9 @@ class AssetManagerFontStyleSet : public SkFontStyleSet { std::shared_ptr asset_manager_; struct TypefaceAsset { - TypefaceAsset(std::string a) : asset(std::move(a)) {} + TypefaceAsset(std::string a); + TypefaceAsset(const TypefaceAsset& other); + ~TypefaceAsset(); std::string asset; sk_sp typeface; }; diff --git a/lib/ui/text/paragraph.h b/lib/ui/text/paragraph.h index f5648440fe65b..15df77310c17a 100644 --- a/lib/ui/text/paragraph.h +++ b/lib/ui/text/paragraph.h @@ -49,7 +49,7 @@ class Paragraph : public RefCountedDartWrappable { Dart_Handle getPositionForOffset(double dx, double dy); Dart_Handle getWordBoundary(unsigned offset); - virtual size_t GetAllocationSize() override; + size_t GetAllocationSize() override; static void RegisterNatives(tonic::DartLibraryNatives* natives); diff --git a/lib/ui/ui_dart_state.h b/lib/ui/ui_dart_state.h index 80758ae0c27ec..9d45cf479dc5b 100644 --- a/lib/ui/ui_dart_state.h +++ b/lib/ui/ui_dart_state.h @@ -61,7 +61,7 @@ class UIDartState : public tonic::DartState { if (!object) { return {}; } - auto state = UIDartState::Current(); + auto* state = UIDartState::Current(); FML_DCHECK(state); auto queue = state->GetSkiaUnrefQueue(); return {std::move(object), std::move(queue)}; From 5f4a62b3ab9167d9846fa29d0733d1ea4f396147 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Mon, 12 Nov 2018 11:18:23 -0800 Subject: [PATCH 03/11] everything but one --- common/settings.cc | 1 + common/settings.h | 1 + lib/ui/semantics/semantics_node.cc | 2 ++ lib/ui/semantics/semantics_node.h | 1 + lib/ui/window/viewport_metrics.cc | 11 ++++++ lib/ui/window/viewport_metrics.h | 3 ++ runtime/dart_isolate.cc | 11 ++++-- runtime/dart_isolate.h | 8 ++--- runtime/dart_vm.cc | 2 +- runtime/runtime_controller.cc | 34 +++++++++++++------ runtime/runtime_controller.h | 13 +++---- runtime/service_protocol.cc | 4 +-- shell/common/rasterizer.cc | 17 +++++++--- shell/common/rasterizer.h | 9 +++-- shell/common/shell.cc | 6 ++-- shell/common/thread_host.cc | 1 + shell/common/thread_host.h | 2 +- .../Source/FlutterPlatformViews_Internal.h | 10 +++--- .../Source/FlutterPlatformViews_Internal.mm | 19 +++++++++++ .../Source/platform_message_response_darwin.h | 21 ++++-------- .../platform_message_response_darwin.mm | 21 +++++++++++- .../darwin/ios/ios_external_texture_gl.h | 8 ++--- .../darwin/ios/ios_surface_software.h | 2 +- shell/platform/darwin/ios/platform_view_ios.h | 2 +- 24 files changed, 144 insertions(+), 65 deletions(-) create mode 100644 lib/ui/window/viewport_metrics.cc create mode 100644 shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm diff --git a/common/settings.cc b/common/settings.cc index 858ad11fefb49..45995142df7dd 100644 --- a/common/settings.cc +++ b/common/settings.cc @@ -9,6 +9,7 @@ namespace blink { Settings::Settings() = default; +Settings::Settings(const Settings& other) = default; Settings::~Settings() = default; std::string Settings::ToString() const { diff --git a/common/settings.h b/common/settings.h index 2d686d8463c23..85a8e9180bd13 100644 --- a/common/settings.h +++ b/common/settings.h @@ -23,6 +23,7 @@ using TaskObserverRemove = std::function; struct Settings { Settings(); + Settings(const Settings& other); ~Settings(); // VM settings diff --git a/lib/ui/semantics/semantics_node.cc b/lib/ui/semantics/semantics_node.cc index 4931f8ca5c830..cb655bdde8831 100644 --- a/lib/ui/semantics/semantics_node.cc +++ b/lib/ui/semantics/semantics_node.cc @@ -10,6 +10,8 @@ namespace blink { SemanticsNode::SemanticsNode() = default; +SemanticsNode::SemanticsNode(const SemanticsNode& other) = default; + SemanticsNode::~SemanticsNode() = default; bool SemanticsNode::HasAction(SemanticsAction action) { diff --git a/lib/ui/semantics/semantics_node.h b/lib/ui/semantics/semantics_node.h index 1752b73b5aac9..a9871a6a5e4d3 100644 --- a/lib/ui/semantics/semantics_node.h +++ b/lib/ui/semantics/semantics_node.h @@ -69,6 +69,7 @@ enum class SemanticsFlags : int32_t { struct SemanticsNode { SemanticsNode(); + SemanticsNode(const SemanticsNode& other); ~SemanticsNode(); bool HasAction(SemanticsAction action); diff --git a/lib/ui/window/viewport_metrics.cc b/lib/ui/window/viewport_metrics.cc new file mode 100644 index 0000000000000..fca01af6857fb --- /dev/null +++ b/lib/ui/window/viewport_metrics.cc @@ -0,0 +1,11 @@ +#include "flutter/lib/ui/window/viewport_metrics.h" + + +namespace blink { + +ViewportMetrics::ViewportMetrics() = default; + +ViewportMetrics::ViewportMetrics(const ViewportMetrics& other) = default; + + +} // namespace blink diff --git a/lib/ui/window/viewport_metrics.h b/lib/ui/window/viewport_metrics.h index 41fe229a5a396..7513832af1092 100644 --- a/lib/ui/window/viewport_metrics.h +++ b/lib/ui/window/viewport_metrics.h @@ -10,6 +10,9 @@ namespace blink { struct ViewportMetrics { + ViewportMetrics(); + ViewportMetrics(const ViewportMetrics& other); + double device_pixel_ratio = 1.0; double physical_width = 0; double physical_height = 0; diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc index c443e7b2eb5e6..772b4d97345cc 100644 --- a/runtime/dart_isolate.cc +++ b/runtime/dart_isolate.cc @@ -152,7 +152,7 @@ bool DartIsolate::Initialize(Dart_Isolate dart_isolate, bool is_root_isolate) { return false; } - auto isolate_data = static_cast*>( + auto* isolate_data = static_cast*>( Dart_IsolateData(dart_isolate)); if (isolate_data->get() != this) { return false; @@ -620,7 +620,7 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair( DartVM* const vm = (*embedder_isolate)->GetDartVM(); if (!is_root_isolate) { - auto raw_embedder_isolate = embedder_isolate.release(); + auto* raw_embedder_isolate = embedder_isolate.release(); blink::TaskRunners null_task_runners(advisory_script_uri, nullptr, nullptr, nullptr, nullptr); @@ -730,4 +730,11 @@ void DartIsolate::AddIsolateShutdownCallback(fml::closure closure) { std::make_unique(std::move(closure))); } +DartIsolate::AutoFireClosure::AutoFireClosure(fml::closure closure) : closure_(std::move(closure)) {} +DartIsolate::AutoFireClosure::~AutoFireClosure() { + if (closure_) { + closure_(); + } +} + } // namespace blink diff --git a/runtime/dart_isolate.h b/runtime/dart_isolate.h index 1eba6219c0d90..784c9ac8b7e69 100644 --- a/runtime/dart_isolate.h +++ b/runtime/dart_isolate.h @@ -98,12 +98,8 @@ class DartIsolate : public UIDartState { class AutoFireClosure { public: - AutoFireClosure(fml::closure closure) : closure_(std::move(closure)) {} - ~AutoFireClosure() { - if (closure_) { - closure_(); - } - } + AutoFireClosure(fml::closure closure); + ~AutoFireClosure(); private: fml::closure closure_; diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc index 55e37f9dd3db3..4c3f67c9f6ff6 100644 --- a/runtime/dart_vm.cc +++ b/runtime/dart_vm.cc @@ -313,7 +313,7 @@ DartVM::DartVM(const Settings& settings, // it does not recognize, it exits immediately. args.push_back("--ignore-unrecognized-flags"); - for (const auto& profiler_flag : + for (auto* const profiler_flag : ProfilingFlags(settings.enable_dart_profiling)) { args.push_back(profiler_flag); } diff --git a/runtime/runtime_controller.cc b/runtime/runtime_controller.cc index 6af501054e586..cdbbd00a29263 100644 --- a/runtime/runtime_controller.cc +++ b/runtime/runtime_controller.cc @@ -75,7 +75,7 @@ RuntimeController::RuntimeController( root_isolate->SetReturnCodeCallback([this](uint32_t code) { root_isolate_return_code_ = {true, code}; }); - if (auto window = GetWindowIfAvailable()) { + if (auto* window = GetWindowIfAvailable()) { tonic::DartState::Scope scope(root_isolate); window->DidCreateIsolate(); if (!FlushRuntimeStateToIsolate()) { @@ -134,7 +134,7 @@ bool RuntimeController::FlushRuntimeStateToIsolate() { bool RuntimeController::SetViewportMetrics(const ViewportMetrics& metrics) { window_data_.viewport_metrics = metrics; - if (auto window = GetWindowIfAvailable()) { + if (auto* window = GetWindowIfAvailable()) { window->UpdateWindowMetrics(metrics); return true; } @@ -145,7 +145,7 @@ bool RuntimeController::SetLocales( const std::vector& locale_data) { window_data_.locale_data = locale_data; - if (auto window = GetWindowIfAvailable()) { + if (auto* window = GetWindowIfAvailable()) { window->UpdateLocales(locale_data); return true; } @@ -155,7 +155,7 @@ bool RuntimeController::SetLocales( bool RuntimeController::SetUserSettingsData(const std::string& data) { window_data_.user_settings_data = data; - if (auto window = GetWindowIfAvailable()) { + if (auto* window = GetWindowIfAvailable()) { window->UpdateUserSettingsData(window_data_.user_settings_data); return true; } @@ -166,7 +166,7 @@ bool RuntimeController::SetUserSettingsData(const std::string& data) { bool RuntimeController::SetSemanticsEnabled(bool enabled) { window_data_.semantics_enabled = enabled; - if (auto window = GetWindowIfAvailable()) { + if (auto* window = GetWindowIfAvailable()) { window->UpdateSemanticsEnabled(window_data_.semantics_enabled); return true; } @@ -176,7 +176,7 @@ bool RuntimeController::SetSemanticsEnabled(bool enabled) { bool RuntimeController::SetAccessibilityFeatures(int32_t flags) { window_data_.accessibility_feature_flags_ = flags; - if (auto window = GetWindowIfAvailable()) { + if (auto* window = GetWindowIfAvailable()) { window->UpdateAccessibilityFeatures( window_data_.accessibility_feature_flags_); return true; @@ -186,7 +186,7 @@ bool RuntimeController::SetAccessibilityFeatures(int32_t flags) { } bool RuntimeController::BeginFrame(fml::TimePoint frame_time) { - if (auto window = GetWindowIfAvailable()) { + if (auto* window = GetWindowIfAvailable()) { window->BeginFrame(frame_time); return true; } @@ -206,7 +206,7 @@ bool RuntimeController::NotifyIdle(int64_t deadline) { bool RuntimeController::DispatchPlatformMessage( fml::RefPtr message) { - if (auto window = GetWindowIfAvailable()) { + if (auto* window = GetWindowIfAvailable()) { TRACE_EVENT1("flutter", "RuntimeController::DispatchPlatformMessage", "mode", "basic"); window->DispatchPlatformMessage(std::move(message)); @@ -217,7 +217,7 @@ bool RuntimeController::DispatchPlatformMessage( bool RuntimeController::DispatchPointerDataPacket( const PointerDataPacket& packet) { - if (auto window = GetWindowIfAvailable()) { + if (auto* window = GetWindowIfAvailable()) { TRACE_EVENT1("flutter", "RuntimeController::DispatchPointerDataPacket", "mode", "basic"); window->DispatchPointerDataPacket(packet); @@ -231,7 +231,7 @@ bool RuntimeController::DispatchSemanticsAction(int32_t id, std::vector args) { TRACE_EVENT1("flutter", "RuntimeController::DispatchSemanticsAction", "mode", "basic"); - if (auto window = GetWindowIfAvailable()) { + if (auto* window = GetWindowIfAvailable()) { window->DispatchSemanticsAction(id, action, std::move(args)); return true; } @@ -310,4 +310,18 @@ std::pair RuntimeController::GetRootIsolateReturnCode() { return root_isolate_return_code_; } +RuntimeController::Locale::Locale(std::string language_code_, + std::string country_code_, + std::string script_code_, + std::string variant_code_) + : language_code(language_code_), + country_code(country_code_), + script_code(script_code_), + variant_code(variant_code_) {} +RuntimeController::Locale::~Locale() = default; + +RuntimeController::WindowData::WindowData() = default; +RuntimeController::WindowData::WindowData(const WindowData& other) = default; +RuntimeController::WindowData::~WindowData() = default; + } // namespace blink diff --git a/runtime/runtime_controller.h b/runtime/runtime_controller.h index b9b4e7ddb52b9..1685d37e1a1be 100644 --- a/runtime/runtime_controller.h +++ b/runtime/runtime_controller.h @@ -38,7 +38,7 @@ class RuntimeController final : public WindowClient { std::string advisory_script_uri, std::string advisory_script_entrypoint); - ~RuntimeController(); + ~RuntimeController() override; std::unique_ptr Clone() const; @@ -83,11 +83,8 @@ class RuntimeController final : public WindowClient { Locale(std::string language_code_, std::string country_code_, std::string script_code_, - std::string variant_code_) - : language_code(language_code_), - country_code(country_code_), - script_code(script_code_), - variant_code(variant_code_) {} + std::string variant_code_); + ~Locale(); std::string language_code; std::string country_code; @@ -96,6 +93,10 @@ class RuntimeController final : public WindowClient { }; struct WindowData { + WindowData(); + WindowData(const WindowData& other); + ~WindowData(); + ViewportMetrics viewport_metrics; std::string language_code; std::string country_code; diff --git a/runtime/service_protocol.cc b/runtime/service_protocol.cc index 25a52f72f87aa..b25a47f3787b0 100644 --- a/runtime/service_protocol.cc +++ b/runtime/service_protocol.cc @@ -177,7 +177,7 @@ bool ServiceProtocol::HandleMessage(fml::StringView method, // Find the handler by its "viewId" in the params. auto view_id_param_found = params.find(fml::StringView{"viewId"}); if (view_id_param_found != params.end()) { - auto handler = reinterpret_cast(std::stoull( + auto* handler = reinterpret_cast(std::stoull( view_id_param_found->second.data() + kViewIdPrefx.size(), nullptr, 16)); auto handler_found = handlers_.find(handler); if (handler_found != handlers_.end()) { @@ -239,7 +239,7 @@ bool ServiceProtocol::HandleListViewsMethod( // Collect handler descriptions on their respective task runners. std::lock_guard lock(handlers_mutex_); std::vector> descriptions; - for (const auto& handler : handlers_) { + for (auto* const handler : handlers_) { fml::AutoResetWaitableEvent latch; Handler::Description description; diff --git a/shell/common/rasterizer.cc b/shell/common/rasterizer.cc index e2274c9a51280..9f3317912e5fa 100644 --- a/shell/common/rasterizer.cc +++ b/shell/common/rasterizer.cc @@ -164,9 +164,9 @@ bool Rasterizer::DrawToSurface(flow::LayerTree& layer_tree) { // for instrumentation. compositor_context_->engine_time().SetLapTime(layer_tree.construction_time()); - auto canvas = frame->SkiaCanvas(); + auto* canvas = frame->SkiaCanvas(); - auto external_view_embedder = surface_->GetExternalViewEmbedder(); + auto* external_view_embedder = surface_->GetExternalViewEmbedder(); if (external_view_embedder != nullptr) { external_view_embedder->BeginFrame(layer_tree.frame_size()); @@ -253,7 +253,7 @@ static sk_sp ScreenshotLayerTreeAsImage( } // Draw the current layer tree into the snapshot surface. - auto canvas = snapshot_surface->getCanvas(); + auto* canvas = snapshot_surface->getCanvas(); // There is no root surface transformation for the screenshot layer. Reset the // matrix to identity. @@ -299,7 +299,7 @@ static sk_sp ScreenshotLayerTreeAsImage( Rasterizer::Screenshot Rasterizer::ScreenshotLastLayerTree( Rasterizer::ScreenshotType type, bool base64_encode) { - auto layer_tree = GetLastLayerTree(); + auto* layer_tree = GetLastLayerTree(); if (layer_tree == nullptr) { FML_LOG(ERROR) << "Last layer tree was null when screenshotting."; return {}; @@ -352,4 +352,13 @@ void Rasterizer::FireNextFrameCallbackIfPresent() { callback(); } +Rasterizer::Screenshot::Screenshot() {} + +Rasterizer::Screenshot::Screenshot(sk_sp p_data, SkISize p_size) + : data(std::move(p_data)), frame_size(p_size) {} + +Rasterizer::Screenshot::Screenshot(const Screenshot& other) = default; + +Rasterizer::Screenshot::~Screenshot() = default; + } // namespace shell diff --git a/shell/common/rasterizer.h b/shell/common/rasterizer.h index 4a7ca3a5cb847..cf02e795b15eb 100644 --- a/shell/common/rasterizer.h +++ b/shell/common/rasterizer.h @@ -54,10 +54,13 @@ class Rasterizer final : public blink::SnapshotDelegate { sk_sp data; SkISize frame_size = SkISize::MakeEmpty(); - Screenshot() {} + Screenshot(); - Screenshot(sk_sp p_data, SkISize p_size) - : data(std::move(p_data)), frame_size(p_size) {} + Screenshot(sk_sp p_data, SkISize p_size); + + Screenshot(const Screenshot& other); + + ~Screenshot(); }; Screenshot ScreenshotLastLayerTree(ScreenshotType type, bool base64_encode); diff --git a/shell/common/shell.cc b/shell/common/shell.cc index c27525a609f45..bc948f638191a 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -588,7 +588,7 @@ void Shell::OnPlatformViewRegisterTexture( task_runners_.GetGPUTaskRunner()->PostTask( [rasterizer = rasterizer_->GetWeakPtr(), texture] { if (rasterizer) { - if (auto registry = rasterizer->GetTextureRegistry()) { + if (auto* registry = rasterizer->GetTextureRegistry()) { registry->RegisterTexture(texture); } } @@ -603,7 +603,7 @@ void Shell::OnPlatformViewUnregisterTexture(int64_t texture_id) { task_runners_.GetGPUTaskRunner()->PostTask( [rasterizer = rasterizer_->GetWeakPtr(), texture_id]() { if (rasterizer) { - if (auto registry = rasterizer->GetTextureRegistry()) { + if (auto* registry = rasterizer->GetTextureRegistry()) { registry->UnregisterTexture(texture_id); } } @@ -618,7 +618,7 @@ void Shell::OnPlatformViewMarkTextureFrameAvailable(int64_t texture_id) { // Tell the rasterizer that one of its textures has a new frame available. task_runners_.GetGPUTaskRunner()->PostTask( [rasterizer = rasterizer_->GetWeakPtr(), texture_id]() { - auto registry = rasterizer->GetTextureRegistry(); + auto* registry = rasterizer->GetTextureRegistry(); if (!registry) { return; diff --git a/shell/common/thread_host.cc b/shell/common/thread_host.cc index 1845a3c529afb..aa32196d74c1f 100644 --- a/shell/common/thread_host.cc +++ b/shell/common/thread_host.cc @@ -7,6 +7,7 @@ namespace shell { ThreadHost::ThreadHost() = default; +ThreadHost::ThreadHost(ThreadHost&&) = default; ThreadHost::ThreadHost(std::string name_prefix, uint64_t mask) { if (mask & ThreadHost::Type::Platform) { diff --git a/shell/common/thread_host.h b/shell/common/thread_host.h index a0a6875b39878..9e09603095644 100644 --- a/shell/common/thread_host.h +++ b/shell/common/thread_host.h @@ -27,7 +27,7 @@ struct ThreadHost { ThreadHost(); - ThreadHost(ThreadHost&&) = default; + ThreadHost(ThreadHost&&); ThreadHost& operator=(ThreadHost&&) = default; diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h index f6fa9c4a02a97..6247b52e7cdc4 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h @@ -32,10 +32,9 @@ class IOSSurface; struct FlutterPlatformViewLayer { FlutterPlatformViewLayer(fml::scoped_nsobject overlay_view, std::unique_ptr ios_surface, - std::unique_ptr surface) - : overlay_view(std::move(overlay_view)), - ios_surface(std::move(ios_surface)), - surface(std::move(surface)){}; + std::unique_ptr surface); + + ~FlutterPlatformViewLayer(); fml::scoped_nsobject overlay_view; std::unique_ptr ios_surface; @@ -44,7 +43,8 @@ struct FlutterPlatformViewLayer { class FlutterPlatformViewsController { public: - FlutterPlatformViewsController() = default; + FlutterPlatformViewsController(); + ~FlutterPlatformViewsController(); void SetFlutterView(UIView* flutter_view); diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm new file mode 100644 index 0000000000000..1014d84e9e1b0 --- /dev/null +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm @@ -0,0 +1,19 @@ +#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h" + + +namespace shell { +FlutterPlatformViewLayer::FlutterPlatformViewLayer(fml::scoped_nsobject overlay_view, + std::unique_ptr ios_surface, + std::unique_ptr surface) + : overlay_view(std::move(overlay_view)), + ios_surface(std::move(ios_surface)), + surface(std::move(surface)){}; + +FlutterPlatformViewLayer::~FlutterPlatformViewLayer() = default; + + +FlutterPlatformViewsController::FlutterPlatformViewsController() = default; +FlutterPlatformViewsController::~FlutterPlatformViewsController() = default; + + +} // namespace shell diff --git a/shell/platform/darwin/ios/framework/Source/platform_message_response_darwin.h b/shell/platform/darwin/ios/framework/Source/platform_message_response_darwin.h index 48a15dbb36f2a..ee6b929bc9843 100644 --- a/shell/platform/darwin/ios/framework/Source/platform_message_response_darwin.h +++ b/shell/platform/darwin/ios/framework/Source/platform_message_response_darwin.h @@ -20,24 +20,15 @@ namespace shell { class PlatformMessageResponseDarwin : public blink::PlatformMessageResponse { public: - void Complete(std::unique_ptr data) override { - fml::RefPtr self(this); - platform_task_runner_->PostTask(fml::MakeCopyable([self, data = std::move(data)]() mutable { - self->callback_.get()(shell::GetNSDataFromMapping(std::move(data))); - })); - } - - void CompleteEmpty() override { - fml::RefPtr self(this); - platform_task_runner_->PostTask( - fml::MakeCopyable([self]() mutable { self->callback_.get()(nil); })); - } + void Complete(std::unique_ptr data) override; + + void CompleteEmpty() override; private: explicit PlatformMessageResponseDarwin(PlatformMessageResponseCallback callback, - fml::RefPtr platform_task_runner) - : callback_(callback, fml::OwnershipPolicy::Retain), - platform_task_runner_(std::move(platform_task_runner)) {} + fml::RefPtr platform_task_runner); + + ~PlatformMessageResponseDarwin() override; fml::ScopedBlock callback_; fml::RefPtr platform_task_runner_; diff --git a/shell/platform/darwin/ios/framework/Source/platform_message_response_darwin.mm b/shell/platform/darwin/ios/framework/Source/platform_message_response_darwin.mm index 3eb396a8f52df..6b09a423f6378 100644 --- a/shell/platform/darwin/ios/framework/Source/platform_message_response_darwin.mm +++ b/shell/platform/darwin/ios/framework/Source/platform_message_response_darwin.mm @@ -6,6 +6,25 @@ namespace shell { -// +PlatformMessageResponseDarwin::PlatformMessageResponseDarwin(PlatformMessageResponseCallback callback, + fml::RefPtr platform_task_runner) + : callback_(callback, fml::OwnershipPolicy::Retain), + platform_task_runner_(std::move(platform_task_runner)) {} + +PlatformMessageResponseDarwin::~PlatformMessageResponseDarwin() = default; + + +void PlatformMessageResponseDarwin::Complete(std::unique_ptr data) { + fml::RefPtr self(this); + platform_task_runner_->PostTask(fml::MakeCopyable([self, data = std::move(data)]() mutable { + self->callback_.get()(shell::GetNSDataFromMapping(std::move(data))); + })); +} + +void PlatformMessageResponseDarwin::CompleteEmpty() { + fml::RefPtr self(this); + platform_task_runner_->PostTask( + fml::MakeCopyable([self]() mutable { self->callback_.get()(nil); })); +} } // namespace shell diff --git a/shell/platform/darwin/ios/ios_external_texture_gl.h b/shell/platform/darwin/ios/ios_external_texture_gl.h index 5ff841ba0b1b1..d258234708a0b 100644 --- a/shell/platform/darwin/ios/ios_external_texture_gl.h +++ b/shell/platform/darwin/ios/ios_external_texture_gl.h @@ -18,13 +18,13 @@ class IOSExternalTextureGL : public flow::Texture { ~IOSExternalTextureGL() override; // Called from GPU thread. - virtual void Paint(SkCanvas& canvas, const SkRect& bounds, bool freeze) override; + void Paint(SkCanvas& canvas, const SkRect& bounds, bool freeze) override; - virtual void OnGrContextCreated() override; + void OnGrContextCreated() override; - virtual void OnGrContextDestroyed() override; + void OnGrContextDestroyed() override; - virtual void MarkNewFrameAvailable() override; + void MarkNewFrameAvailable() override; private: NSObject* external_texture_; diff --git a/shell/platform/darwin/ios/ios_surface_software.h b/shell/platform/darwin/ios/ios_surface_software.h index 5106bdfb0aa3e..79695b3a2767d 100644 --- a/shell/platform/darwin/ios/ios_surface_software.h +++ b/shell/platform/darwin/ios/ios_surface_software.h @@ -58,7 +58,7 @@ class IOSSurfaceSoftware final : public IOSSurface, SkCanvas* CompositeEmbeddedView(int view_id, const flow::EmbeddedViewParams& params) override; // |flow::ExternalViewEmbedder| - virtual bool SubmitFrame(GrContext* context) override; + bool SubmitFrame(GrContext* context) override; private: fml::scoped_nsobject layer_; diff --git a/shell/platform/darwin/ios/platform_view_ios.h b/shell/platform/darwin/ios/platform_view_ios.h index 6db35651d7f8b..a0d85a7ffd0f9 100644 --- a/shell/platform/darwin/ios/platform_view_ios.h +++ b/shell/platform/darwin/ios/platform_view_ios.h @@ -27,7 +27,7 @@ class PlatformViewIOS final : public PlatformView { public: explicit PlatformViewIOS(PlatformView::Delegate& delegate, blink::TaskRunners task_runners); - ~PlatformViewIOS(); + ~PlatformViewIOS() override; PlatformMessageRouter& GetPlatformMessageRouter(); From 799e820afb09686cd89536ce2ffbb4ce0011f2f1 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Mon, 12 Nov 2018 14:05:20 -0800 Subject: [PATCH 04/11] ++ --- lib/ui/BUILD.gn | 1 + lib/ui/window/viewport_metrics.cc | 25 ++++++++++++++++++- lib/ui/window/viewport_metrics.h | 1 + .../android/platform_view_android_jni.cc | 25 +++++++++---------- shell/platform/darwin/ios/BUILD.gn | 1 + .../Source/FlutterPlatformViews_Internal.mm | 1 + 6 files changed, 40 insertions(+), 14 deletions(-) diff --git a/lib/ui/BUILD.gn b/lib/ui/BUILD.gn index 8ecf508e5a2f7..dcfd483638eca 100644 --- a/lib/ui/BUILD.gn +++ b/lib/ui/BUILD.gn @@ -92,6 +92,7 @@ source_set("ui") { "window/pointer_data.h", "window/pointer_data_packet.cc", "window/pointer_data_packet.h", + "window/viewport_metrics.cc", "window/viewport_metrics.h", "window/window.cc", "window/window.h", diff --git a/lib/ui/window/viewport_metrics.cc b/lib/ui/window/viewport_metrics.cc index fca01af6857fb..d2ef29ce274d2 100644 --- a/lib/ui/window/viewport_metrics.cc +++ b/lib/ui/window/viewport_metrics.cc @@ -2,8 +2,31 @@ namespace blink { - ViewportMetrics::ViewportMetrics() = default; +ViewportMetrics::ViewportMetrics( + double p_device_pixel_ratio, + double p_physical_width, + double p_physical_height, + double p_physical_padding_top, + double p_physical_padding_right, + double p_physical_padding_bottom, + double p_physical_padding_left, + double p_physical_view_inset_top, + double p_physical_view_inset_right, + double p_physical_view_inset_bottom, + double p_physical_view_inset_left) : + device_pixel_ratio(p_device_pixel_ratio), + physical_width(p_physical_width), + physical_height(p_physical_height), + physical_padding_top(p_physical_padding_top), + physical_padding_right(p_physical_padding_right), + physical_padding_bottom(p_physical_padding_bottom), + physical_padding_left(p_physical_padding_left), + physical_view_inset_top(p_physical_view_inset_top), + physical_view_inset_right(p_physical_view_inset_right), + physical_view_inset_bottom(p_physical_view_inset_bottom), + physical_view_inset_left(p_physical_view_inset_left) +{} ViewportMetrics::ViewportMetrics(const ViewportMetrics& other) = default; diff --git a/lib/ui/window/viewport_metrics.h b/lib/ui/window/viewport_metrics.h index 7513832af1092..e8c0e643dd2c8 100644 --- a/lib/ui/window/viewport_metrics.h +++ b/lib/ui/window/viewport_metrics.h @@ -11,6 +11,7 @@ namespace blink { struct ViewportMetrics { ViewportMetrics(); + ViewportMetrics(double p_device_pixel_ratio, double p_physical_width, double p_physical_height, double p_physical_padding_top, double p_physical_padding_right, double p_physical_padding_bottom, double p_physical_padding_left, double p_physical_view_inset_top, double p_physical_view_inset_right, double p_physical_view_inset_bottom, double p_physical_view_inset_left); ViewportMetrics(const ViewportMetrics& other); double device_pixel_ratio = 1.0; diff --git a/shell/platform/android/platform_view_android_jni.cc b/shell/platform/android/platform_view_android_jni.cc index a829e25f16654..9632df5377de5 100644 --- a/shell/platform/android/platform_view_android_jni.cc +++ b/shell/platform/android/platform_view_android_jni.cc @@ -329,19 +329,18 @@ static void SetViewportMetrics(JNIEnv* env, jint physicalViewInsetRight, jint physicalViewInsetBottom, jint physicalViewInsetLeft) { - const blink::ViewportMetrics metrics = { - .device_pixel_ratio = static_cast(devicePixelRatio), - .physical_width = static_cast(physicalWidth), - .physical_height = static_cast(physicalHeight), - .physical_padding_top = static_cast(physicalPaddingTop), - .physical_padding_right = static_cast(physicalPaddingRight), - .physical_padding_bottom = static_cast(physicalPaddingBottom), - .physical_padding_left = static_cast(physicalPaddingLeft), - .physical_view_inset_top = static_cast(physicalViewInsetTop), - .physical_view_inset_right = static_cast(physicalViewInsetRight), - .physical_view_inset_bottom = - static_cast(physicalViewInsetBottom), - .physical_view_inset_left = static_cast(physicalViewInsetLeft), + const blink::ViewportMetrics metrics{ + static_cast(devicePixelRatio), + static_cast(physicalWidth), + static_cast(physicalHeight), + static_cast(physicalPaddingTop), + static_cast(physicalPaddingRight), + static_cast(physicalPaddingBottom), + static_cast(physicalPaddingLeft), + static_cast(physicalViewInsetTop), + static_cast(physicalViewInsetRight), + static_cast(physicalViewInsetBottom), + static_cast(physicalViewInsetLeft), }; ANDROID_SHELL_HOLDER->SetViewportMetrics(metrics); diff --git a/shell/platform/darwin/ios/BUILD.gn b/shell/platform/darwin/ios/BUILD.gn index 235dfa054facd..8adbfc627970e 100644 --- a/shell/platform/darwin/ios/BUILD.gn +++ b/shell/platform/darwin/ios/BUILD.gn @@ -62,6 +62,7 @@ shared_library("create_flutter_framework_dylib") { "framework/Source/FlutterPlatformPlugin.h", "framework/Source/FlutterPlatformPlugin.mm", "framework/Source/FlutterPlatformViews_Internal.h", + "framework/Source/FlutterPlatformViews_Internal.mm", "framework/Source/FlutterPlatformViews.mm", "framework/Source/FlutterPluginAppLifeCycleDelegate.mm", "framework/Source/FlutterStandardCodec.mm", diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm index 1014d84e9e1b0..c917d0c7439ad 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm @@ -1,5 +1,6 @@ #include "flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h" +#include "flutter/shell/platform/darwin/ios/ios_surface.h" namespace shell { FlutterPlatformViewLayer::FlutterPlatformViewLayer(fml::scoped_nsobject overlay_view, From 4ceaa2a5ea1d77726ee9bbc193b2e3b4bbc93838 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Mon, 12 Nov 2018 14:34:17 -0800 Subject: [PATCH 05/11] Android --- shell/platform/android/android_external_texture_gl.h | 6 +++--- shell/platform/android/apk_asset_provider.h | 2 +- shell/platform/android/platform_message_response_android.cc | 6 ++++-- shell/platform/android/platform_message_response_android.h | 1 + shell/platform/android/platform_view_android_jni.cc | 2 +- shell/platform/android/vsync_waiter_android.cc | 2 +- shell/platform/darwin/ios/ios_surface_gl.h | 2 +- 7 files changed, 12 insertions(+), 9 deletions(-) diff --git a/shell/platform/android/android_external_texture_gl.h b/shell/platform/android/android_external_texture_gl.h index 7ac9ce82b3516..5980d891cb141 100644 --- a/shell/platform/android/android_external_texture_gl.h +++ b/shell/platform/android/android_external_texture_gl.h @@ -19,13 +19,13 @@ class AndroidExternalTextureGL : public flow::Texture { ~AndroidExternalTextureGL() override; - virtual void Paint(SkCanvas& canvas, + void Paint(SkCanvas& canvas, const SkRect& bounds, bool freeze) override; - virtual void OnGrContextCreated() override; + void OnGrContextCreated() override; - virtual void OnGrContextDestroyed() override; + void OnGrContextDestroyed() override; void MarkNewFrameAvailable() override; diff --git a/shell/platform/android/apk_asset_provider.h b/shell/platform/android/apk_asset_provider.h index bb8215a191a28..be41a685ebfeb 100644 --- a/shell/platform/android/apk_asset_provider.h +++ b/shell/platform/android/apk_asset_provider.h @@ -19,7 +19,7 @@ class APKAssetProvider final : public AssetResolver { explicit APKAssetProvider(JNIEnv* env, jobject assetManager, std::string directory); - virtual ~APKAssetProvider(); + ~APKAssetProvider() override; private: fml::jni::ScopedJavaGlobalRef java_asset_manager_; diff --git a/shell/platform/android/platform_message_response_android.cc b/shell/platform/android/platform_message_response_android.cc index d87e1a6237d22..eb88a6a5840bb 100644 --- a/shell/platform/android/platform_message_response_android.cc +++ b/shell/platform/android/platform_message_response_android.cc @@ -17,6 +17,8 @@ PlatformMessageResponseAndroid::PlatformMessageResponseAndroid( weak_java_object_(weak_java_object), platform_task_runner_(std::move(platform_task_runner)) {} +PlatformMessageResponseAndroid::~PlatformMessageResponseAndroid() = default; + // |blink::PlatformMessageResponse| void PlatformMessageResponseAndroid::Complete( std::unique_ptr data) { @@ -27,7 +29,7 @@ void PlatformMessageResponseAndroid::Complete( ]() { // We are on the platform thread. Attempt to get the strong reference to // the Java object. - auto env = fml::jni::AttachCurrentThread(); + auto* env = fml::jni::AttachCurrentThread(); auto java_object = weak_java_object.get(env); if (java_object.is_null()) { @@ -57,7 +59,7 @@ void PlatformMessageResponseAndroid::CompleteEmpty() { ]() { // We are on the platform thread. Attempt to get the strong reference to // the Java object. - auto env = fml::jni::AttachCurrentThread(); + auto* env = fml::jni::AttachCurrentThread(); auto java_object = weak_java_object.get(env); if (java_object.is_null()) { diff --git a/shell/platform/android/platform_message_response_android.h b/shell/platform/android/platform_message_response_android.h index 71b080cc3348c..a1d51d1f0600c 100644 --- a/shell/platform/android/platform_message_response_android.h +++ b/shell/platform/android/platform_message_response_android.h @@ -25,6 +25,7 @@ class PlatformMessageResponseAndroid : public blink::PlatformMessageResponse { int response_id, fml::jni::JavaObjectWeakGlobalRef weak_java_object, fml::RefPtr platform_task_runner); + ~PlatformMessageResponseAndroid() override; int response_id_; fml::jni::JavaObjectWeakGlobalRef weak_java_object_; diff --git a/shell/platform/android/platform_view_android_jni.cc b/shell/platform/android/platform_view_android_jni.cc index 9632df5377de5..be42414b6c9be 100644 --- a/shell/platform/android/platform_view_android_jni.cc +++ b/shell/platform/android/platform_view_android_jni.cc @@ -365,7 +365,7 @@ static jobject GetBitmap(JNIEnv* env, jobject jcaller, jlong shell_holder) { return nullptr; } - auto pixels_src = static_cast(screenshot.data->data()); + auto* pixels_src = static_cast(screenshot.data->data()); // Our configuration of Skia does not support rendering to the // BitmapConfig.ARGB_8888 format expected by android.graphics.Bitmap. diff --git a/shell/platform/android/vsync_waiter_android.cc b/shell/platform/android/vsync_waiter_android.cc index dc1cb11b3f21e..7d551c71143a8 100644 --- a/shell/platform/android/vsync_waiter_android.cc +++ b/shell/platform/android/vsync_waiter_android.cc @@ -84,7 +84,7 @@ bool VsyncWaiterAndroid::Register(JNIEnv* env) { static void ConsumePendingCallback(jlong java_baton, fml::TimePoint frame_start_time, fml::TimePoint frame_target_time) { - auto weak_this = reinterpret_cast*>(java_baton); + auto* weak_this = reinterpret_cast*>(java_baton); auto shared_this = weak_this->lock(); delete weak_this; diff --git a/shell/platform/darwin/ios/ios_surface_gl.h b/shell/platform/darwin/ios/ios_surface_gl.h index 9f7013c29b100..93fcc0f510624 100644 --- a/shell/platform/darwin/ios/ios_surface_gl.h +++ b/shell/platform/darwin/ios/ios_surface_gl.h @@ -63,7 +63,7 @@ class IOSSurfaceGL : public IOSSurface, SkCanvas* CompositeEmbeddedView(int view_id, const flow::EmbeddedViewParams& params) override; // |flow::ExternalViewEmbedder| - virtual bool SubmitFrame(GrContext* context) override; + bool SubmitFrame(GrContext* context) override; private: std::shared_ptr context_; From 0c47879d0e8a21017a6aead8afe401cfdbd3a057 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Mon, 12 Nov 2018 15:01:12 -0800 Subject: [PATCH 06/11] ++ --- shell/gpu/gpu_surface_gl.cc | 16 ++++++++++++++++ shell/gpu/gpu_surface_gl.h | 16 +++++----------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/shell/gpu/gpu_surface_gl.cc b/shell/gpu/gpu_surface_gl.cc index d7c014382f696..45663927fd9c1 100644 --- a/shell/gpu/gpu_surface_gl.cc +++ b/shell/gpu/gpu_surface_gl.cc @@ -368,4 +368,20 @@ bool GPUSurfaceGL::MakeRenderContextCurrent() { return delegate_->GLContextMakeCurrent(); } +bool GPUSurfaceGLDelegate::GLContextFBOResetAfterPresent() const { return false; } + +bool GPUSurfaceGLDelegate::UseOffscreenSurface() const { return false; } + +SkMatrix GPUSurfaceGLDelegate::GLContextSurfaceTransformation() const { + SkMatrix matrix; + matrix.setIdentity(); + return matrix; +} + +flow::ExternalViewEmbedder* GPUSurfaceGLDelegate::GetExternalViewEmbedder() { + return nullptr; +} + +GPUSurfaceGLDelegate::GLProcResolver GPUSurfaceGLDelegate::GetGLProcResolver() const { return nullptr; } + } // namespace shell diff --git a/shell/gpu/gpu_surface_gl.h b/shell/gpu/gpu_surface_gl.h index 28c22d6a72e8d..a268e6d28020f 100644 --- a/shell/gpu/gpu_surface_gl.h +++ b/shell/gpu/gpu_surface_gl.h @@ -26,23 +26,17 @@ class GPUSurfaceGLDelegate { virtual intptr_t GLContextFBO() const = 0; - virtual bool GLContextFBOResetAfterPresent() const { return false; } + virtual bool GLContextFBOResetAfterPresent() const; - virtual bool UseOffscreenSurface() const { return false; } + virtual bool UseOffscreenSurface() const; - virtual SkMatrix GLContextSurfaceTransformation() const { - SkMatrix matrix; - matrix.setIdentity(); - return matrix; - } + virtual SkMatrix GLContextSurfaceTransformation() const; - virtual flow::ExternalViewEmbedder* GetExternalViewEmbedder() { - return nullptr; - } + virtual flow::ExternalViewEmbedder* GetExternalViewEmbedder(); using GLProcResolver = std::function; - virtual GLProcResolver GetGLProcResolver() const { return nullptr; } + virtual GLProcResolver GetGLProcResolver() const; }; class GPUSurfaceGL : public Surface { From 734539b7586170cddafe174942c95f31ecd21f04 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Mon, 12 Nov 2018 15:49:10 -0800 Subject: [PATCH 07/11] ++ --- flow/embedded_views.cc | 5 ++++- fml/thread_local.cc | 4 ++++ lib/ui/window/viewport_metrics.cc | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/flow/embedded_views.cc b/flow/embedded_views.cc index 5468488036287..70b20e6dbdaf8 100644 --- a/flow/embedded_views.cc +++ b/flow/embedded_views.cc @@ -1,5 +1,8 @@ -#include "flutter/flow/embedded_views.h" +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +#include "flutter/flow/embedded_views.h" namespace flow { diff --git a/fml/thread_local.cc b/fml/thread_local.cc index b9561bbcf051e..0fea932f94d31 100644 --- a/fml/thread_local.cc +++ b/fml/thread_local.cc @@ -1,3 +1,7 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + #include "flutter/fml/thread_local.h" namespace fml { diff --git a/lib/ui/window/viewport_metrics.cc b/lib/ui/window/viewport_metrics.cc index d2ef29ce274d2..d7a4993a7d8e8 100644 --- a/lib/ui/window/viewport_metrics.cc +++ b/lib/ui/window/viewport_metrics.cc @@ -1,3 +1,7 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + #include "flutter/lib/ui/window/viewport_metrics.h" From 50d1573a1cf967cd74edccae94cdf96d6c1a0b3f Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Mon, 12 Nov 2018 15:51:15 -0800 Subject: [PATCH 08/11] format --- flow/embedded_views.cc | 4 +- flow/raster_cache.cc | 3 +- fml/message.cc | 4 +- fml/message_loop_impl.cc | 4 +- fml/thread_local.cc | 5 +- lib/ui/painting/codec.cc | 22 ++++++--- lib/ui/painting/engine_layer.cc | 2 +- lib/ui/painting/frame_info.cc | 2 +- lib/ui/text/asset_manager_font_provider.cc | 8 ++-- lib/ui/window/viewport_metrics.cc | 48 +++++++++---------- lib/ui/window/viewport_metrics.h | 12 ++++- runtime/dart_isolate.cc | 3 +- runtime/runtime_controller.cc | 6 +-- shell/gpu/gpu_surface_gl.cc | 13 +++-- .../android/android_external_texture_gl.h | 4 +- .../Source/FlutterPlatformViews_Internal.mm | 6 +-- .../platform_message_response_darwin.mm | 10 ++-- 17 files changed, 92 insertions(+), 64 deletions(-) diff --git a/flow/embedded_views.cc b/flow/embedded_views.cc index 70b20e6dbdaf8..8dc634ecdd62d 100644 --- a/flow/embedded_views.cc +++ b/flow/embedded_views.cc @@ -6,5 +6,7 @@ namespace flow { - bool ExternalViewEmbedder::SubmitFrame(GrContext* context) { return false; }; +bool ExternalViewEmbedder::SubmitFrame(GrContext* context) { + return false; +}; } // namespace flow diff --git a/flow/raster_cache.cc b/flow/raster_cache.cc index 128605bacad8a..ccb88ab48c7c7 100644 --- a/flow/raster_cache.cc +++ b/flow/raster_cache.cc @@ -24,7 +24,8 @@ RasterCacheResult::RasterCacheResult(const RasterCacheResult& other) = default; RasterCacheResult::~RasterCacheResult() = default; -RasterCacheResult::RasterCacheResult(sk_sp image, const SkRect& logical_rect) +RasterCacheResult::RasterCacheResult(sk_sp image, + const SkRect& logical_rect) : image_(std::move(image)), logical_rect_(logical_rect) {} void RasterCacheResult::draw(SkCanvas& canvas, const SkPaint* paint) const { diff --git a/fml/message.cc b/fml/message.cc index acf48e4bd2195..4ef7ab3b32274 100644 --- a/fml/message.cc +++ b/fml/message.cc @@ -8,7 +8,9 @@ namespace fml { -size_t MessageSerializable::GetSerializableTag() const { return 0; }; +size_t MessageSerializable::GetSerializableTag() const { + return 0; +}; Message::Message() = default; diff --git a/fml/message_loop_impl.cc b/fml/message_loop_impl.cc index f38a525ecaaec..4d2c5bf4ff614 100644 --- a/fml/message_loop_impl.cc +++ b/fml/message_loop_impl.cc @@ -146,8 +146,8 @@ void MessageLoopImpl::RunExpiredTasks() { } MessageLoopImpl::DelayedTask::DelayedTask(size_t p_order, - fml::closure p_task, - fml::TimePoint p_target_time) + fml::closure p_task, + fml::TimePoint p_target_time) : order(p_order), task(std::move(p_task)), target_time(p_target_time) {} MessageLoopImpl::DelayedTask::DelayedTask(const DelayedTask& other) = default; diff --git a/fml/thread_local.cc b/fml/thread_local.cc index 0fea932f94d31..4617f8243c17d 100644 --- a/fml/thread_local.cc +++ b/fml/thread_local.cc @@ -8,7 +8,8 @@ namespace fml { ThreadLocal::ThreadLocal() : ThreadLocal(nullptr) {} -ThreadLocal::ThreadLocal(ThreadLocalDestroyCallback destroy) : destroy_(destroy) { +ThreadLocal::ThreadLocal(ThreadLocalDestroyCallback destroy) + : destroy_(destroy) { auto callback = reinterpret_cast(&ThreadLocal::ThreadLocalDestroy); FML_CHECK(pthread_key_create(&_key, callback) == 0); @@ -32,4 +33,4 @@ ThreadLocal::Box::Box(ThreadLocalDestroyCallback destroy, intptr_t value) ThreadLocal::Box::~Box() = default; -} +} // namespace fml diff --git a/lib/ui/painting/codec.cc b/lib/ui/painting/codec.cc index 73ae0d170f5b4..46b4693128498 100644 --- a/lib/ui/painting/codec.cc +++ b/lib/ui/painting/codec.cc @@ -389,8 +389,12 @@ MultiFrameCodec::MultiFrameCodec(std::unique_ptr codec, MultiFrameCodec::~MultiFrameCodec() {} -int MultiFrameCodec::frameCount() { return frameInfos_.size(); } -int MultiFrameCodec::repetitionCount() { return repetitionCount_; } +int MultiFrameCodec::frameCount() { + return frameInfos_.size(); +} +int MultiFrameCodec::repetitionCount() { + return repetitionCount_; +} sk_sp MultiFrameCodec::GetNextFrameImage( fml::WeakPtr resourceContext) { @@ -504,14 +508,20 @@ Dart_Handle MultiFrameCodec::getNextFrame(Dart_Handle callback_handle) { return Dart_Null(); } -MultiFrameCodec::DecodedFrame::DecodedFrame(bool required) : required_(required) {} +MultiFrameCodec::DecodedFrame::DecodedFrame(bool required) + : required_(required) {} MultiFrameCodec::DecodedFrame::~DecodedFrame() = default; -SingleFrameCodec::SingleFrameCodec(fml::RefPtr frame) : frame_(std::move(frame)) {} +SingleFrameCodec::SingleFrameCodec(fml::RefPtr frame) + : frame_(std::move(frame)) {} SingleFrameCodec::~SingleFrameCodec() {} -int SingleFrameCodec::frameCount() { return 1; } -int SingleFrameCodec::repetitionCount() { return 0; } +int SingleFrameCodec::frameCount() { + return 1; +} +int SingleFrameCodec::repetitionCount() { + return 0; +} Dart_Handle SingleFrameCodec::getNextFrame(Dart_Handle callback_handle) { if (!Dart_IsClosure(callback_handle)) { diff --git a/lib/ui/painting/engine_layer.cc b/lib/ui/painting/engine_layer.cc index 416b1549b115a..f365e37cb8fbc 100644 --- a/lib/ui/painting/engine_layer.cc +++ b/lib/ui/painting/engine_layer.cc @@ -16,7 +16,7 @@ using tonic::ToDart; namespace blink { EngineLayer::EngineLayer(std::shared_ptr layer) - : layer_(layer) {} + : layer_(layer) {} EngineLayer::~EngineLayer() = default; diff --git a/lib/ui/painting/frame_info.cc b/lib/ui/painting/frame_info.cc index 07d36ba968d74..241457fd86270 100644 --- a/lib/ui/painting/frame_info.cc +++ b/lib/ui/painting/frame_info.cc @@ -20,7 +20,7 @@ FOR_EACH_BINDING(DART_NATIVE_CALLBACK) FrameInfo::FrameInfo(fml::RefPtr image, int durationMillis) : image_(std::move(image)), durationMillis_(durationMillis) {} -FrameInfo::~FrameInfo() {}; +FrameInfo::~FrameInfo(){}; void FrameInfo::RegisterNatives(tonic::DartLibraryNatives* natives) { natives->Register({FOR_EACH_BINDING(DART_REGISTER_NATIVE)}); diff --git a/lib/ui/text/asset_manager_font_provider.cc b/lib/ui/text/asset_manager_font_provider.cc index ba2713c60d23b..23c5a01923317 100644 --- a/lib/ui/text/asset_manager_font_provider.cc +++ b/lib/ui/text/asset_manager_font_provider.cc @@ -123,9 +123,11 @@ SkTypeface* AssetManagerFontStyleSet::matchStyle(const SkFontStyle& pattern) { return SkRef(assets_[0].typeface.get()); } - AssetManagerFontStyleSet::TypefaceAsset::TypefaceAsset(std::string a) : asset(std::move(a)) {} - AssetManagerFontStyleSet::TypefaceAsset::TypefaceAsset(const AssetManagerFontStyleSet::TypefaceAsset& other) = default; +AssetManagerFontStyleSet::TypefaceAsset::TypefaceAsset(std::string a) + : asset(std::move(a)) {} +AssetManagerFontStyleSet::TypefaceAsset::TypefaceAsset( + const AssetManagerFontStyleSet::TypefaceAsset& other) = default; - AssetManagerFontStyleSet::TypefaceAsset::~TypefaceAsset() = default; +AssetManagerFontStyleSet::TypefaceAsset::~TypefaceAsset() = default; } // namespace blink diff --git a/lib/ui/window/viewport_metrics.cc b/lib/ui/window/viewport_metrics.cc index d7a4993a7d8e8..a99432f0a5cf0 100644 --- a/lib/ui/window/viewport_metrics.cc +++ b/lib/ui/window/viewport_metrics.cc @@ -4,35 +4,31 @@ #include "flutter/lib/ui/window/viewport_metrics.h" - namespace blink { ViewportMetrics::ViewportMetrics() = default; -ViewportMetrics::ViewportMetrics( - double p_device_pixel_ratio, - double p_physical_width, - double p_physical_height, - double p_physical_padding_top, - double p_physical_padding_right, - double p_physical_padding_bottom, - double p_physical_padding_left, - double p_physical_view_inset_top, - double p_physical_view_inset_right, - double p_physical_view_inset_bottom, - double p_physical_view_inset_left) : - device_pixel_ratio(p_device_pixel_ratio), - physical_width(p_physical_width), - physical_height(p_physical_height), - physical_padding_top(p_physical_padding_top), - physical_padding_right(p_physical_padding_right), - physical_padding_bottom(p_physical_padding_bottom), - physical_padding_left(p_physical_padding_left), - physical_view_inset_top(p_physical_view_inset_top), - physical_view_inset_right(p_physical_view_inset_right), - physical_view_inset_bottom(p_physical_view_inset_bottom), - physical_view_inset_left(p_physical_view_inset_left) -{} +ViewportMetrics::ViewportMetrics(double p_device_pixel_ratio, + double p_physical_width, + double p_physical_height, + double p_physical_padding_top, + double p_physical_padding_right, + double p_physical_padding_bottom, + double p_physical_padding_left, + double p_physical_view_inset_top, + double p_physical_view_inset_right, + double p_physical_view_inset_bottom, + double p_physical_view_inset_left) + : device_pixel_ratio(p_device_pixel_ratio), + physical_width(p_physical_width), + physical_height(p_physical_height), + physical_padding_top(p_physical_padding_top), + physical_padding_right(p_physical_padding_right), + physical_padding_bottom(p_physical_padding_bottom), + physical_padding_left(p_physical_padding_left), + physical_view_inset_top(p_physical_view_inset_top), + physical_view_inset_right(p_physical_view_inset_right), + physical_view_inset_bottom(p_physical_view_inset_bottom), + physical_view_inset_left(p_physical_view_inset_left) {} ViewportMetrics::ViewportMetrics(const ViewportMetrics& other) = default; - } // namespace blink diff --git a/lib/ui/window/viewport_metrics.h b/lib/ui/window/viewport_metrics.h index e8c0e643dd2c8..bc6854e531bdb 100644 --- a/lib/ui/window/viewport_metrics.h +++ b/lib/ui/window/viewport_metrics.h @@ -11,7 +11,17 @@ namespace blink { struct ViewportMetrics { ViewportMetrics(); - ViewportMetrics(double p_device_pixel_ratio, double p_physical_width, double p_physical_height, double p_physical_padding_top, double p_physical_padding_right, double p_physical_padding_bottom, double p_physical_padding_left, double p_physical_view_inset_top, double p_physical_view_inset_right, double p_physical_view_inset_bottom, double p_physical_view_inset_left); + ViewportMetrics(double p_device_pixel_ratio, + double p_physical_width, + double p_physical_height, + double p_physical_padding_top, + double p_physical_padding_right, + double p_physical_padding_bottom, + double p_physical_padding_left, + double p_physical_view_inset_top, + double p_physical_view_inset_right, + double p_physical_view_inset_bottom, + double p_physical_view_inset_left); ViewportMetrics(const ViewportMetrics& other); double device_pixel_ratio = 1.0; diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc index 772b4d97345cc..a5c2fd005adfa 100644 --- a/runtime/dart_isolate.cc +++ b/runtime/dart_isolate.cc @@ -730,7 +730,8 @@ void DartIsolate::AddIsolateShutdownCallback(fml::closure closure) { std::make_unique(std::move(closure))); } -DartIsolate::AutoFireClosure::AutoFireClosure(fml::closure closure) : closure_(std::move(closure)) {} +DartIsolate::AutoFireClosure::AutoFireClosure(fml::closure closure) + : closure_(std::move(closure)) {} DartIsolate::AutoFireClosure::~AutoFireClosure() { if (closure_) { closure_(); diff --git a/runtime/runtime_controller.cc b/runtime/runtime_controller.cc index cdbbd00a29263..3fa1bed798503 100644 --- a/runtime/runtime_controller.cc +++ b/runtime/runtime_controller.cc @@ -311,9 +311,9 @@ std::pair RuntimeController::GetRootIsolateReturnCode() { } RuntimeController::Locale::Locale(std::string language_code_, - std::string country_code_, - std::string script_code_, - std::string variant_code_) + std::string country_code_, + std::string script_code_, + std::string variant_code_) : language_code(language_code_), country_code(country_code_), script_code(script_code_), diff --git a/shell/gpu/gpu_surface_gl.cc b/shell/gpu/gpu_surface_gl.cc index 45663927fd9c1..d0ff74ffb6e24 100644 --- a/shell/gpu/gpu_surface_gl.cc +++ b/shell/gpu/gpu_surface_gl.cc @@ -368,9 +368,13 @@ bool GPUSurfaceGL::MakeRenderContextCurrent() { return delegate_->GLContextMakeCurrent(); } -bool GPUSurfaceGLDelegate::GLContextFBOResetAfterPresent() const { return false; } +bool GPUSurfaceGLDelegate::GLContextFBOResetAfterPresent() const { + return false; +} -bool GPUSurfaceGLDelegate::UseOffscreenSurface() const { return false; } +bool GPUSurfaceGLDelegate::UseOffscreenSurface() const { + return false; +} SkMatrix GPUSurfaceGLDelegate::GLContextSurfaceTransformation() const { SkMatrix matrix; @@ -382,6 +386,9 @@ flow::ExternalViewEmbedder* GPUSurfaceGLDelegate::GetExternalViewEmbedder() { return nullptr; } -GPUSurfaceGLDelegate::GLProcResolver GPUSurfaceGLDelegate::GetGLProcResolver() const { return nullptr; } +GPUSurfaceGLDelegate::GLProcResolver GPUSurfaceGLDelegate::GetGLProcResolver() + const { + return nullptr; +} } // namespace shell diff --git a/shell/platform/android/android_external_texture_gl.h b/shell/platform/android/android_external_texture_gl.h index 5980d891cb141..09a56766e2a8f 100644 --- a/shell/platform/android/android_external_texture_gl.h +++ b/shell/platform/android/android_external_texture_gl.h @@ -19,9 +19,7 @@ class AndroidExternalTextureGL : public flow::Texture { ~AndroidExternalTextureGL() override; - void Paint(SkCanvas& canvas, - const SkRect& bounds, - bool freeze) override; + void Paint(SkCanvas& canvas, const SkRect& bounds, bool freeze) override; void OnGrContextCreated() override; diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm index c917d0c7439ad..d64c96f822e48 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm @@ -4,17 +4,15 @@ namespace shell { FlutterPlatformViewLayer::FlutterPlatformViewLayer(fml::scoped_nsobject overlay_view, - std::unique_ptr ios_surface, - std::unique_ptr surface) + std::unique_ptr ios_surface, + std::unique_ptr surface) : overlay_view(std::move(overlay_view)), ios_surface(std::move(ios_surface)), surface(std::move(surface)){}; FlutterPlatformViewLayer::~FlutterPlatformViewLayer() = default; - FlutterPlatformViewsController::FlutterPlatformViewsController() = default; FlutterPlatformViewsController::~FlutterPlatformViewsController() = default; - } // namespace shell diff --git a/shell/platform/darwin/ios/framework/Source/platform_message_response_darwin.mm b/shell/platform/darwin/ios/framework/Source/platform_message_response_darwin.mm index 6b09a423f6378..0d45e4e2ff4e1 100644 --- a/shell/platform/darwin/ios/framework/Source/platform_message_response_darwin.mm +++ b/shell/platform/darwin/ios/framework/Source/platform_message_response_darwin.mm @@ -6,14 +6,14 @@ namespace shell { -PlatformMessageResponseDarwin::PlatformMessageResponseDarwin(PlatformMessageResponseCallback callback, - fml::RefPtr platform_task_runner) - : callback_(callback, fml::OwnershipPolicy::Retain), - platform_task_runner_(std::move(platform_task_runner)) {} +PlatformMessageResponseDarwin::PlatformMessageResponseDarwin( + PlatformMessageResponseCallback callback, + fml::RefPtr platform_task_runner) + : callback_(callback, fml::OwnershipPolicy::Retain), + platform_task_runner_(std::move(platform_task_runner)) {} PlatformMessageResponseDarwin::~PlatformMessageResponseDarwin() = default; - void PlatformMessageResponseDarwin::Complete(std::unique_ptr data) { fml::RefPtr self(this); platform_task_runner_->PostTask(fml::MakeCopyable([self, data = std::move(data)]() mutable { From b2d5d14a505cdf064124136529443f2b75881891 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Mon, 12 Nov 2018 16:06:27 -0800 Subject: [PATCH 09/11] ++ --- flow/embedded_views.h | 2 +- fml/message.h | 2 +- .../ios/framework/Source/FlutterPlatformViews_Internal.mm | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/flow/embedded_views.h b/flow/embedded_views.h index 5e8dd5814e974..6f2e684c4841e 100644 --- a/flow/embedded_views.h +++ b/flow/embedded_views.h @@ -37,7 +37,7 @@ class ExternalViewEmbedder { virtual SkCanvas* CompositeEmbeddedView(int view_id, const EmbeddedViewParams& params) = 0; - virtual bool SubmitFrame(GrContext* context) = 0; + virtual bool SubmitFrame(GrContext* context); virtual ~ExternalViewEmbedder() = default; diff --git a/fml/message.h b/fml/message.h index b291228da0885..f9d6bf804ed85 100644 --- a/fml/message.h +++ b/fml/message.h @@ -47,7 +47,7 @@ class MessageSerializable { virtual bool Deserialize(Message& message) = 0; - virtual size_t GetSerializableTag() const = 0; + virtual size_t GetSerializableTag() const; }; // The traits passed to the encode/decode calls that accept traits should be diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm index d64c96f822e48..47e8894be79e0 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm @@ -1,3 +1,7 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + #include "flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h" #include "flutter/shell/platform/darwin/ios/ios_surface.h" From 812860faa75b0bd7ce699d94ab258d414b35e813 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Mon, 12 Nov 2018 16:41:44 -0800 Subject: [PATCH 10/11] nits --- common/settings.cc | 2 ++ common/settings.h | 2 ++ flow/raster_cache.h | 2 ++ fml/message_loop_impl.h | 2 ++ fml/thread_local.h | 1 + lib/ui/isolate_name_server/isolate_name_server.h | 1 + lib/ui/painting/codec.cc | 4 ++++ lib/ui/painting/frame_info.cc | 1 + lib/ui/painting/frame_info.h | 1 + lib/ui/semantics/semantics_node.h | 2 ++ lib/ui/text/asset_manager_font_provider.cc | 1 + lib/ui/text/asset_manager_font_provider.h | 3 +++ lib/ui/window/viewport_metrics.cc | 1 + lib/ui/window/viewport_metrics.h | 2 ++ runtime/dart_isolate.cc | 1 + runtime/dart_isolate.h | 1 + runtime/runtime_controller.cc | 3 +++ runtime/runtime_controller.h | 3 +++ shell/common/thread_host.cc | 1 + shell/platform/android/platform_message_response_android.h | 1 + .../ios/framework/Source/FlutterPlatformViews_Internal.h | 1 + .../ios/framework/Source/FlutterPlatformViews_Internal.mm | 1 + 22 files changed, 37 insertions(+) diff --git a/common/settings.cc b/common/settings.cc index 45995142df7dd..a85d69fc8596c 100644 --- a/common/settings.cc +++ b/common/settings.cc @@ -9,7 +9,9 @@ namespace blink { Settings::Settings() = default; + Settings::Settings(const Settings& other) = default; + Settings::~Settings() = default; std::string Settings::ToString() const { diff --git a/common/settings.h b/common/settings.h index 85a8e9180bd13..92a8e37109ff2 100644 --- a/common/settings.h +++ b/common/settings.h @@ -23,7 +23,9 @@ using TaskObserverRemove = std::function; struct Settings { Settings(); + Settings(const Settings& other); + ~Settings(); // VM settings diff --git a/flow/raster_cache.h b/flow/raster_cache.h index a7894183347b0..cb4383f41fb52 100644 --- a/flow/raster_cache.h +++ b/flow/raster_cache.h @@ -20,7 +20,9 @@ namespace flow { class RasterCacheResult { public: RasterCacheResult(); + RasterCacheResult(const RasterCacheResult& other); + ~RasterCacheResult(); RasterCacheResult(sk_sp image, const SkRect& logical_rect); diff --git a/fml/message_loop_impl.h b/fml/message_loop_impl.h index 15def86a0ec59..9dab218d0d1db 100644 --- a/fml/message_loop_impl.h +++ b/fml/message_loop_impl.h @@ -58,7 +58,9 @@ class MessageLoopImpl : public fml::RefCountedThreadSafe { DelayedTask(size_t p_order, fml::closure p_task, fml::TimePoint p_target_time); + DelayedTask(const DelayedTask& other); + ~DelayedTask(); }; diff --git a/fml/thread_local.h b/fml/thread_local.h index 49347f104173a..b2d4bdfa774c0 100644 --- a/fml/thread_local.h +++ b/fml/thread_local.h @@ -32,6 +32,7 @@ class ThreadLocal { class Box { public: Box(ThreadLocalDestroyCallback destroy, intptr_t value); + ~Box(); intptr_t Value() const { return value_; } diff --git a/lib/ui/isolate_name_server/isolate_name_server.h b/lib/ui/isolate_name_server/isolate_name_server.h index aa8a7e0f0590e..db62ad871f771 100644 --- a/lib/ui/isolate_name_server/isolate_name_server.h +++ b/lib/ui/isolate_name_server/isolate_name_server.h @@ -18,6 +18,7 @@ namespace blink { class IsolateNameServer { public: IsolateNameServer(); + ~IsolateNameServer(); // Looks up the Dart_Port associated with a given name. Returns ILLEGAL_PORT diff --git a/lib/ui/painting/codec.cc b/lib/ui/painting/codec.cc index 46b4693128498..4cec237fd9ed5 100644 --- a/lib/ui/painting/codec.cc +++ b/lib/ui/painting/codec.cc @@ -392,6 +392,7 @@ MultiFrameCodec::~MultiFrameCodec() {} int MultiFrameCodec::frameCount() { return frameInfos_.size(); } + int MultiFrameCodec::repetitionCount() { return repetitionCount_; } @@ -510,15 +511,18 @@ Dart_Handle MultiFrameCodec::getNextFrame(Dart_Handle callback_handle) { MultiFrameCodec::DecodedFrame::DecodedFrame(bool required) : required_(required) {} + MultiFrameCodec::DecodedFrame::~DecodedFrame() = default; SingleFrameCodec::SingleFrameCodec(fml::RefPtr frame) : frame_(std::move(frame)) {} + SingleFrameCodec::~SingleFrameCodec() {} int SingleFrameCodec::frameCount() { return 1; } + int SingleFrameCodec::repetitionCount() { return 0; } diff --git a/lib/ui/painting/frame_info.cc b/lib/ui/painting/frame_info.cc index 241457fd86270..40359a02dce77 100644 --- a/lib/ui/painting/frame_info.cc +++ b/lib/ui/painting/frame_info.cc @@ -20,6 +20,7 @@ FOR_EACH_BINDING(DART_NATIVE_CALLBACK) FrameInfo::FrameInfo(fml::RefPtr image, int durationMillis) : image_(std::move(image)), durationMillis_(durationMillis) {} + FrameInfo::~FrameInfo(){}; void FrameInfo::RegisterNatives(tonic::DartLibraryNatives* natives) { diff --git a/lib/ui/painting/frame_info.h b/lib/ui/painting/frame_info.h index 1a3ed5f6b90cf..57ff23d91c43a 100644 --- a/lib/ui/painting/frame_info.h +++ b/lib/ui/painting/frame_info.h @@ -26,6 +26,7 @@ class FrameInfo final : public RefCountedDartWrappable { private: FrameInfo(fml::RefPtr image, int durationMillis); + ~FrameInfo() override; const fml::RefPtr image_; diff --git a/lib/ui/semantics/semantics_node.h b/lib/ui/semantics/semantics_node.h index a9871a6a5e4d3..4275cb7d83d30 100644 --- a/lib/ui/semantics/semantics_node.h +++ b/lib/ui/semantics/semantics_node.h @@ -69,7 +69,9 @@ enum class SemanticsFlags : int32_t { struct SemanticsNode { SemanticsNode(); + SemanticsNode(const SemanticsNode& other); + ~SemanticsNode(); bool HasAction(SemanticsAction action); diff --git a/lib/ui/text/asset_manager_font_provider.cc b/lib/ui/text/asset_manager_font_provider.cc index 23c5a01923317..da2d0a15be9d7 100644 --- a/lib/ui/text/asset_manager_font_provider.cc +++ b/lib/ui/text/asset_manager_font_provider.cc @@ -125,6 +125,7 @@ SkTypeface* AssetManagerFontStyleSet::matchStyle(const SkFontStyle& pattern) { AssetManagerFontStyleSet::TypefaceAsset::TypefaceAsset(std::string a) : asset(std::move(a)) {} + AssetManagerFontStyleSet::TypefaceAsset::TypefaceAsset( const AssetManagerFontStyleSet::TypefaceAsset& other) = default; diff --git a/lib/ui/text/asset_manager_font_provider.h b/lib/ui/text/asset_manager_font_provider.h index ef414bc2c5582..d55cf71e3bd93 100644 --- a/lib/ui/text/asset_manager_font_provider.h +++ b/lib/ui/text/asset_manager_font_provider.h @@ -43,8 +43,11 @@ class AssetManagerFontStyleSet : public SkFontStyleSet { struct TypefaceAsset { TypefaceAsset(std::string a); + TypefaceAsset(const TypefaceAsset& other); + ~TypefaceAsset(); + std::string asset; sk_sp typeface; }; diff --git a/lib/ui/window/viewport_metrics.cc b/lib/ui/window/viewport_metrics.cc index a99432f0a5cf0..1047b3e4da1cf 100644 --- a/lib/ui/window/viewport_metrics.cc +++ b/lib/ui/window/viewport_metrics.cc @@ -6,6 +6,7 @@ namespace blink { ViewportMetrics::ViewportMetrics() = default; + ViewportMetrics::ViewportMetrics(double p_device_pixel_ratio, double p_physical_width, double p_physical_height, diff --git a/lib/ui/window/viewport_metrics.h b/lib/ui/window/viewport_metrics.h index bc6854e531bdb..c4daa9ebe7192 100644 --- a/lib/ui/window/viewport_metrics.h +++ b/lib/ui/window/viewport_metrics.h @@ -11,6 +11,7 @@ namespace blink { struct ViewportMetrics { ViewportMetrics(); + ViewportMetrics(double p_device_pixel_ratio, double p_physical_width, double p_physical_height, @@ -22,6 +23,7 @@ struct ViewportMetrics { double p_physical_view_inset_right, double p_physical_view_inset_bottom, double p_physical_view_inset_left); + ViewportMetrics(const ViewportMetrics& other); double device_pixel_ratio = 1.0; diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc index a5c2fd005adfa..ee480a68ba6b5 100644 --- a/runtime/dart_isolate.cc +++ b/runtime/dart_isolate.cc @@ -732,6 +732,7 @@ void DartIsolate::AddIsolateShutdownCallback(fml::closure closure) { DartIsolate::AutoFireClosure::AutoFireClosure(fml::closure closure) : closure_(std::move(closure)) {} + DartIsolate::AutoFireClosure::~AutoFireClosure() { if (closure_) { closure_(); diff --git a/runtime/dart_isolate.h b/runtime/dart_isolate.h index 784c9ac8b7e69..86fce82aaf3b2 100644 --- a/runtime/dart_isolate.h +++ b/runtime/dart_isolate.h @@ -99,6 +99,7 @@ class DartIsolate : public UIDartState { class AutoFireClosure { public: AutoFireClosure(fml::closure closure); + ~AutoFireClosure(); private: diff --git a/runtime/runtime_controller.cc b/runtime/runtime_controller.cc index 3fa1bed798503..0beacff828fcd 100644 --- a/runtime/runtime_controller.cc +++ b/runtime/runtime_controller.cc @@ -318,10 +318,13 @@ RuntimeController::Locale::Locale(std::string language_code_, country_code(country_code_), script_code(script_code_), variant_code(variant_code_) {} + RuntimeController::Locale::~Locale() = default; RuntimeController::WindowData::WindowData() = default; + RuntimeController::WindowData::WindowData(const WindowData& other) = default; + RuntimeController::WindowData::~WindowData() = default; } // namespace blink diff --git a/runtime/runtime_controller.h b/runtime/runtime_controller.h index 1685d37e1a1be..97941e3a16ac2 100644 --- a/runtime/runtime_controller.h +++ b/runtime/runtime_controller.h @@ -84,6 +84,7 @@ class RuntimeController final : public WindowClient { std::string country_code_, std::string script_code_, std::string variant_code_); + ~Locale(); std::string language_code; @@ -94,7 +95,9 @@ class RuntimeController final : public WindowClient { struct WindowData { WindowData(); + WindowData(const WindowData& other); + ~WindowData(); ViewportMetrics viewport_metrics; diff --git a/shell/common/thread_host.cc b/shell/common/thread_host.cc index aa32196d74c1f..d8a2a73006eb4 100644 --- a/shell/common/thread_host.cc +++ b/shell/common/thread_host.cc @@ -7,6 +7,7 @@ namespace shell { ThreadHost::ThreadHost() = default; + ThreadHost::ThreadHost(ThreadHost&&) = default; ThreadHost::ThreadHost(std::string name_prefix, uint64_t mask) { diff --git a/shell/platform/android/platform_message_response_android.h b/shell/platform/android/platform_message_response_android.h index a1d51d1f0600c..f3d79c1aa4faf 100644 --- a/shell/platform/android/platform_message_response_android.h +++ b/shell/platform/android/platform_message_response_android.h @@ -25,6 +25,7 @@ class PlatformMessageResponseAndroid : public blink::PlatformMessageResponse { int response_id, fml::jni::JavaObjectWeakGlobalRef weak_java_object, fml::RefPtr platform_task_runner); + ~PlatformMessageResponseAndroid() override; int response_id_; diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h index 6247b52e7cdc4..4173a1ebf6871 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h @@ -44,6 +44,7 @@ struct FlutterPlatformViewLayer { class FlutterPlatformViewsController { public: FlutterPlatformViewsController(); + ~FlutterPlatformViewsController(); void SetFlutterView(UIView* flutter_view); diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm index 47e8894be79e0..b6c85c60974fb 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm @@ -17,6 +17,7 @@ FlutterPlatformViewLayer::~FlutterPlatformViewLayer() = default; FlutterPlatformViewsController::FlutterPlatformViewsController() = default; + FlutterPlatformViewsController::~FlutterPlatformViewsController() = default; } // namespace shell From e5aa79826f66644c9c382c87ed94f509c9a7963a Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Mon, 12 Nov 2018 17:07:20 -0800 Subject: [PATCH 11/11] ll --- ci/licenses_golden/licenses_flutter | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 125b745183048..79f415685ceff 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -27,6 +27,7 @@ FILE: ../../../flutter/flow/compositor_context.cc FILE: ../../../flutter/flow/compositor_context.h FILE: ../../../flutter/flow/debug_print.cc FILE: ../../../flutter/flow/debug_print.h +FILE: ../../../flutter/flow/embedded_views.cc FILE: ../../../flutter/flow/embedded_views.h FILE: ../../../flutter/flow/export_node.cc FILE: ../../../flutter/flow/export_node.h @@ -189,6 +190,7 @@ 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_local.cc FILE: ../../../flutter/fml/thread_local.h FILE: ../../../flutter/fml/thread_local_unittests.cc FILE: ../../../flutter/fml/thread_unittests.cc @@ -311,6 +313,7 @@ FILE: ../../../flutter/lib/ui/window/pointer_data.cc FILE: ../../../flutter/lib/ui/window/pointer_data.h FILE: ../../../flutter/lib/ui/window/pointer_data_packet.cc FILE: ../../../flutter/lib/ui/window/pointer_data_packet.h +FILE: ../../../flutter/lib/ui/window/viewport_metrics.cc FILE: ../../../flutter/lib/ui/window/viewport_metrics.h FILE: ../../../flutter/lib/ui/window/window.cc FILE: ../../../flutter/lib/ui/window/window.h @@ -496,6 +499,7 @@ FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatfor FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterPluginAppLifeCycleDelegate.mm FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec.mm FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec_Internal.h