diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-02-13 15:05:36 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-02-14 10:33:47 +0000 |
commit | e684a3455bcc29a6e3e66a004e352dea4e1141e7 (patch) | |
tree | d55b4003bde34d7d05f558f02cfd82b2a66a7aac /chromium/ppapi | |
parent | 2b94bfe47ccb6c08047959d1c26e392919550e86 (diff) | |
download | qtwebengine-chromium-e684a3455bcc29a6e3e66a004e352dea4e1141e7.tar.gz |
BASELINE: Update Chromium to 72.0.3626.110 and Ninja to 1.9.0
Change-Id: Ic57220b00ecc929a893c91f5cc552f5d3e99e922
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/ppapi')
26 files changed, 152 insertions, 146 deletions
diff --git a/chromium/ppapi/cpp/BUILD.gn b/chromium/ppapi/cpp/BUILD.gn index a5d692b8a56..da877e90889 100644 --- a/chromium/ppapi/cpp/BUILD.gn +++ b/chromium/ppapi/cpp/BUILD.gn @@ -2,6 +2,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/jumbo.gni") + if (is_nacl) { import("//build/config/nacl/config.gni") } @@ -9,7 +11,7 @@ if (is_nacl) { if (is_nacl && is_nacl_glibc) { cpp_target_type = "shared_library" } else { - cpp_target_type = "static_library" + cpp_target_type = "jumbo_static_library" } # Link to this target to get the PPAPI C++ wrapper objects and plugin startup @@ -50,7 +52,7 @@ target(cpp_target_type, "cpp") { # Link to this target to get only the PPAPI C++ wrapper objects but not the # plugin startup code. Some plugins need special startup code that they supply # themselves. -source_set("objects") { +jumbo_source_set("objects") { sources = [ "array_output.cc", "array_output.h", @@ -91,6 +93,7 @@ source_set("objects") { "image_data.h", "input_event.cc", "input_event.h", + "input_event_interface_name.h", "instance.cc", "instance.h", "instance_handle.cc", diff --git a/chromium/ppapi/cpp/input_event.cc b/chromium/ppapi/cpp/input_event.cc index 2bd3ec71c6b..044e33579c9 100644 --- a/chromium/ppapi/cpp/input_event.cc +++ b/chromium/ppapi/cpp/input_event.cc @@ -4,6 +4,7 @@ #include "ppapi/cpp/input_event.h" +#include "ppapi/cpp/input_event_interface_name.h" #include "ppapi/cpp/instance_handle.h" #include "ppapi/cpp/module.h" #include "ppapi/cpp/module_impl.h" @@ -15,10 +16,6 @@ namespace pp { namespace { -template <> const char* interface_name<PPB_InputEvent_1_0>() { - return PPB_INPUT_EVENT_INTERFACE_1_0; -} - template <> const char* interface_name<PPB_KeyboardInputEvent_1_2>() { return PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_2; } diff --git a/chromium/ppapi/cpp/input_event_interface_name.h b/chromium/ppapi/cpp/input_event_interface_name.h new file mode 100644 index 00000000000..8918fe6c305 --- /dev/null +++ b/chromium/ppapi/cpp/input_event_interface_name.h @@ -0,0 +1,24 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef PPAPI_CPP_INPUT_EVENT_INTERFACE_NAME_H_ +#define PPAPI_CPP_INPUT_EVENT_INTERFACE_NAME_H_ + +#include "ppapi/c/ppb_input_event.h" +#include "ppapi/cpp/module_impl.h" + +namespace pp { + +namespace { + +// This implementation is shared between instance.cc and input_event.cc +template <> +const char* interface_name<PPB_InputEvent_1_0>() { + return PPB_INPUT_EVENT_INTERFACE_1_0; +} + +} // namespace +} // namespace pp + +#endif // PPAPI_CPP_INPUT_EVENT_INTERFACE_NAME_H_ diff --git a/chromium/ppapi/cpp/instance.cc b/chromium/ppapi/cpp/instance.cc index 74b93216729..08c815571aa 100644 --- a/chromium/ppapi/cpp/instance.cc +++ b/chromium/ppapi/cpp/instance.cc @@ -14,6 +14,7 @@ #include "ppapi/cpp/graphics_2d.h" #include "ppapi/cpp/graphics_3d.h" #include "ppapi/cpp/image_data.h" +#include "ppapi/cpp/input_event_interface_name.h" #include "ppapi/cpp/instance_handle.h" #include "ppapi/cpp/logging.h" #include "ppapi/cpp/message_handler.h" @@ -33,10 +34,6 @@ template <> const char* interface_name<PPB_Console_1_0>() { return PPB_CONSOLE_INTERFACE_1_0; } -template <> const char* interface_name<PPB_InputEvent_1_0>() { - return PPB_INPUT_EVENT_INTERFACE_1_0; -} - template <> const char* interface_name<PPB_Instance_1_0>() { return PPB_INSTANCE_INTERFACE_1_0; } diff --git a/chromium/ppapi/cpp/module_impl.h b/chromium/ppapi/cpp/module_impl.h index fa2c61923be..28a6cf6364f 100644 --- a/chromium/ppapi/cpp/module_impl.h +++ b/chromium/ppapi/cpp/module_impl.h @@ -17,9 +17,8 @@ namespace { // Specialize this function to return the interface string corresponding to the // PP?_XXX structure. -template <typename T> const char* interface_name() { - return NULL; -} +template <typename T> +const char* interface_name(); template <typename T> inline T const* get_interface() { static T const* funcs = reinterpret_cast<T const*>( diff --git a/chromium/ppapi/host/BUILD.gn b/chromium/ppapi/host/BUILD.gn index 32d33282786..56b452670a5 100644 --- a/chromium/ppapi/host/BUILD.gn +++ b/chromium/ppapi/host/BUILD.gn @@ -2,7 +2,9 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -component("host") { +import("//build/config/jumbo.gni") + +jumbo_component("host") { output_name = "ppapi_host" sources = [ diff --git a/chromium/ppapi/host/resource_message_filter_unittest.cc b/chromium/ppapi/host/resource_message_filter_unittest.cc index 76b82fdd769..976b1fb201b 100644 --- a/chromium/ppapi/host/resource_message_filter_unittest.cc +++ b/chromium/ppapi/host/resource_message_filter_unittest.cc @@ -7,12 +7,11 @@ #include "base/bind.h" #include "base/bind_helpers.h" #include "base/location.h" -#include "base/message_loop/message_loop.h" -#include "base/message_loop/message_loop_current.h" #include "base/run_loop.h" #include "base/single_thread_task_runner.h" #include "base/synchronization/waitable_event.h" #include "base/threading/thread.h" +#include "base/threading/thread_task_runner_handle.h" #include "ipc/ipc_message.h" #include "ppapi/c/pp_errors.h" #include "ppapi/host/host_message_context.h" @@ -52,12 +51,12 @@ class MyResourceHost : public ResourceHost { : ResourceHost(host, instance, resource), msg_type_(msg_type), reply_msg_type_(reply_msg_type), - last_reply_message_loop_(NULL) {} + last_reply_task_runner_(NULL) {} const IPC::Message& last_handled_msg() const { return last_handled_msg_; } const IPC::Message& last_reply_msg() const { return last_reply_msg_; } - base::MessageLoop* last_reply_message_loop() const { - return last_reply_message_loop_; + scoped_refptr<base::SingleThreadTaskRunner> last_reply_task_runner() const { + return last_reply_task_runner_; } void AddMessageFilter(scoped_refptr<ResourceMessageFilter> filter) { @@ -78,7 +77,7 @@ class MyResourceHost : public ResourceHost { void SendReply(const ReplyMessageContext& context, const IPC::Message& msg) override { last_reply_msg_ = msg; - last_reply_message_loop_ = base::MessageLoopCurrent::Get(); + last_reply_task_runner_ = base::ThreadTaskRunnerHandle::Get(); g_handler_completion.Signal(); } @@ -88,7 +87,7 @@ class MyResourceHost : public ResourceHost { IPC::Message last_handled_msg_; IPC::Message last_reply_msg_; - base::MessageLoop* last_reply_message_loop_; + scoped_refptr<base::SingleThreadTaskRunner> last_reply_task_runner_; }; // Dummy message filter which simply stores a copy of messages it handles. @@ -107,11 +106,12 @@ class MyResourceFilter : public ResourceMessageFilter { : ResourceMessageFilter(io_thread.task_runner()), task_runner_(bg_thread.task_runner()), msg_type_(msg_type), - reply_msg_type_(reply_msg_type), - last_message_loop_(NULL) {} + reply_msg_type_(reply_msg_type) {} const IPC::Message& last_handled_msg() const { return last_handled_msg_; } - base::MessageLoop* last_message_loop() const { return last_message_loop_; } + scoped_refptr<base::SingleThreadTaskRunner> last_task_runner() const { + return last_task_runner_; + } scoped_refptr<base::TaskRunner> OverrideTaskRunnerForMessage( const IPC::Message& msg) override { @@ -124,7 +124,7 @@ class MyResourceFilter : public ResourceMessageFilter { const IPC::Message& msg, HostMessageContext* context) override { last_handled_msg_ = msg; - last_message_loop_ = base::MessageLoopCurrent::Get(); + last_task_runner_ = base::ThreadTaskRunnerHandle::Get(); if (msg.type() == msg_type_) { context->reply_msg = IPC::Message(0, reply_msg_type_, IPC::Message::PRIORITY_NORMAL); @@ -139,7 +139,7 @@ class MyResourceFilter : public ResourceMessageFilter { uint32_t reply_msg_type_; IPC::Message last_handled_msg_; - base::MessageLoop* last_message_loop_; + scoped_refptr<base::SingleThreadTaskRunner> last_task_runner_; }; } // namespace @@ -177,20 +177,20 @@ class ResourceMessageFilterTest : public testing::Test { host.HandleMessage(message1, &context); g_handler_completion.Wait(); EXPECT_EQ(filter1->last_handled_msg().type(), message1.type()); - EXPECT_EQ(filter1->last_message_loop(), bg_thread1.message_loop()); + EXPECT_EQ(filter1->last_task_runner(), bg_thread1.task_runner()); EXPECT_EQ(host.last_reply_msg().type(), static_cast<uint32_t>(REPLY_MSG1_TYPE)); - EXPECT_EQ(host.last_reply_message_loop(), io_thread.message_loop()); + EXPECT_EQ(host.last_reply_task_runner(), io_thread.task_runner()); g_handler_completion.Reset(); // Message 2 handled by the second filter. host.HandleMessage(message2, &context); g_handler_completion.Wait(); EXPECT_EQ(filter2->last_handled_msg().type(), message2.type()); - EXPECT_EQ(filter2->last_message_loop(), bg_thread2.message_loop()); + EXPECT_EQ(filter2->last_task_runner(), bg_thread2.task_runner()); EXPECT_EQ(host.last_reply_msg().type(), static_cast<uint32_t>(REPLY_MSG2_TYPE)); - EXPECT_EQ(host.last_reply_message_loop(), io_thread.message_loop()); + EXPECT_EQ(host.last_reply_task_runner(), io_thread.task_runner()); g_handler_completion.Reset(); // Message 3 handled by the resource host. diff --git a/chromium/ppapi/nacl_irt/ppapi_dispatcher.cc b/chromium/ppapi/nacl_irt/ppapi_dispatcher.cc index b1ec3a916c6..210ae97e8cf 100644 --- a/chromium/ppapi/nacl_irt/ppapi_dispatcher.cc +++ b/chromium/ppapi/nacl_irt/ppapi_dispatcher.cc @@ -182,6 +182,7 @@ void PpapiDispatcher::OnMsgInitializeNaClDispatcher( settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; logging::InitLogging(settings); + base::FeatureList::ClearInstanceForTesting(); base::FeatureList::InitializeInstance( base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( switches::kEnableFeatures), diff --git a/chromium/ppapi/proxy/BUILD.gn b/chromium/ppapi/proxy/BUILD.gn index 075e81eefbe..49f38370678 100644 --- a/chromium/ppapi/proxy/BUILD.gn +++ b/chromium/ppapi/proxy/BUILD.gn @@ -2,13 +2,14 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/jumbo.gni") import("//build/config/nacl/config.gni") config("proxy_implementation") { defines = [ "PPAPI_PROXY_IMPLEMENTATION" ] } -component("proxy") { +jumbo_component("proxy") { output_name = "ppapi_proxy" sources = [ @@ -365,7 +366,7 @@ source_set("ipc_sources") { } } -static_library("test_support") { +jumbo_static_library("test_support") { testonly = true sources = [ diff --git a/chromium/ppapi/proxy/audio_encoder_resource.cc b/chromium/ppapi/proxy/audio_encoder_resource.cc index 51dcab44e32..f9036639c3f 100644 --- a/chromium/ppapi/proxy/audio_encoder_resource.cc +++ b/chromium/ppapi/proxy/audio_encoder_resource.cc @@ -18,18 +18,6 @@ namespace ppapi { namespace proxy { -namespace { - -void RunCallback(scoped_refptr<TrackedCallback>* callback, int32_t error) { - if (TrackedCallback::IsPending(*callback)) { - scoped_refptr<TrackedCallback> temp; - callback->swap(temp); - temp->Run(error); - } -} - -} // namespace - AudioEncoderResource::AudioEncoderResource(Connection connection, PP_Instance instance) : PluginResource(connection, instance), @@ -205,12 +193,12 @@ void AudioEncoderResource::OnPluginMsgGetSupportedProfilesReply( ArrayWriter writer(output); if (params.result() != PP_OK || !writer.is_valid() || !writer.StoreVector(profiles)) { - RunCallback(&get_supported_profiles_callback_, PP_ERROR_FAILED); + SafeRunCallback(&get_supported_profiles_callback_, PP_ERROR_FAILED); return; } - RunCallback(&get_supported_profiles_callback_, - base::checked_cast<int32_t>(profiles.size())); + SafeRunCallback(&get_supported_profiles_callback_, + base::checked_cast<int32_t>(profiles.size())); } void AudioEncoderResource::OnPluginMsgInitializeReply( @@ -224,7 +212,7 @@ void AudioEncoderResource::OnPluginMsgInitializeReply( int32_t error = params.result(); if (error) { - RunCallback(&initialize_callback_, error); + SafeRunCallback(&initialize_callback_, error); return; } @@ -234,7 +222,7 @@ void AudioEncoderResource::OnPluginMsgInitializeReply( !audio_buffer_manager_.SetBuffers( audio_buffer_count, audio_buffer_size, std::make_unique<base::SharedMemory>(buffer_handle, false), true)) { - RunCallback(&initialize_callback_, PP_ERROR_NOMEMORY); + SafeRunCallback(&initialize_callback_, PP_ERROR_NOMEMORY); return; } @@ -243,7 +231,7 @@ void AudioEncoderResource::OnPluginMsgInitializeReply( !bitstream_buffer_manager_.SetBuffers( bitstream_buffer_count, bitstream_buffer_size, std::make_unique<base::SharedMemory>(buffer_handle, false), false)) { - RunCallback(&initialize_callback_, PP_ERROR_NOMEMORY); + SafeRunCallback(&initialize_callback_, PP_ERROR_NOMEMORY); return; } @@ -255,7 +243,7 @@ void AudioEncoderResource::OnPluginMsgInitializeReply( number_of_samples_ = number_of_samples; initialized_ = true; - RunCallback(&initialize_callback_, PP_OK); + SafeRunCallback(&initialize_callback_, PP_OK); } void AudioEncoderResource::OnPluginMsgEncodeReply( @@ -273,7 +261,7 @@ void AudioEncoderResource::OnPluginMsgEncodeReply( scoped_refptr<TrackedCallback> callback = it->second; encode_callbacks_.erase(it); - RunCallback(&callback, encoder_last_error_); + SafeRunCallback(&callback, encoder_last_error_); audio_buffer_manager_.EnqueueBuffer(buffer_id); // If the plugin is waiting for an audio buffer, we can give the one @@ -301,15 +289,15 @@ void AudioEncoderResource::NotifyError(int32_t error) { DCHECK(error); encoder_last_error_ = error; - RunCallback(&get_supported_profiles_callback_, error); - RunCallback(&initialize_callback_, error); - RunCallback(&get_buffer_callback_, error); + SafeRunCallback(&get_supported_profiles_callback_, error); + SafeRunCallback(&initialize_callback_, error); + SafeRunCallback(&get_buffer_callback_, error); get_buffer_data_ = nullptr; - RunCallback(&get_bitstream_buffer_callback_, error); + SafeRunCallback(&get_bitstream_buffer_callback_, error); get_bitstream_buffer_data_ = nullptr; for (EncodeMap::iterator it = encode_callbacks_.begin(); it != encode_callbacks_.end(); ++it) - RunCallback(&it->second, error); + SafeRunCallback(&it->second, error); encode_callbacks_.clear(); } @@ -329,7 +317,7 @@ void AudioEncoderResource::TryGetAudioBuffer() { // Take a reference for the plugin. *get_buffer_data_ = resource->GetReference(); get_buffer_data_ = nullptr; - RunCallback(&get_buffer_callback_, PP_OK); + SafeRunCallback(&get_buffer_callback_, PP_OK); } void AudioEncoderResource::TryWriteBitstreamBuffer() { @@ -345,7 +333,7 @@ void AudioEncoderResource::TryWriteBitstreamBuffer() { get_bitstream_buffer_data_->buffer = buffer->bitstream.data; get_bitstream_buffer_data_->size = buffer->bitstream.data_size; get_bitstream_buffer_data_ = nullptr; - RunCallback(&get_bitstream_buffer_callback_, PP_OK); + SafeRunCallback(&get_bitstream_buffer_callback_, PP_OK); } void AudioEncoderResource::ReleaseBuffers() { diff --git a/chromium/ppapi/proxy/host_dispatcher.cc b/chromium/ppapi/proxy/host_dispatcher.cc index a5fdfcaf1c9..3eb4b87aec9 100644 --- a/chromium/ppapi/proxy/host_dispatcher.cc +++ b/chromium/ppapi/proxy/host_dispatcher.cc @@ -21,8 +21,8 @@ namespace proxy { namespace { -typedef std::map<PP_Instance, HostDispatcher*> InstanceToDispatcherMap; -InstanceToDispatcherMap* g_instance_to_dispatcher = NULL; +typedef std::map<PP_Instance, HostDispatcher*> InstanceToHostDispatcherMap; +InstanceToHostDispatcherMap* g_instance_to_host_dispatcher = NULL; typedef std::map<PP_Module, HostDispatcher*> ModuleToDispatcherMap; ModuleToDispatcherMap* g_module_to_dispatcher = NULL; @@ -101,11 +101,11 @@ bool HostDispatcher::InitHostWithChannel( // static HostDispatcher* HostDispatcher::GetForInstance(PP_Instance instance) { - if (!g_instance_to_dispatcher) + if (!g_instance_to_host_dispatcher) return NULL; - InstanceToDispatcherMap::iterator found = g_instance_to_dispatcher->find( - instance); - if (found == g_instance_to_dispatcher->end()) + InstanceToHostDispatcherMap::iterator found = + g_instance_to_host_dispatcher->find(instance); + if (found == g_instance_to_host_dispatcher->end()) return NULL; return found->second; } @@ -113,19 +113,19 @@ HostDispatcher* HostDispatcher::GetForInstance(PP_Instance instance) { // static void HostDispatcher::SetForInstance(PP_Instance instance, HostDispatcher* dispatcher) { - if (!g_instance_to_dispatcher) - g_instance_to_dispatcher = new InstanceToDispatcherMap; - (*g_instance_to_dispatcher)[instance] = dispatcher; + if (!g_instance_to_host_dispatcher) + g_instance_to_host_dispatcher = new InstanceToHostDispatcherMap; + (*g_instance_to_host_dispatcher)[instance] = dispatcher; } // static void HostDispatcher::RemoveForInstance(PP_Instance instance) { - if (!g_instance_to_dispatcher) + if (!g_instance_to_host_dispatcher) return; - InstanceToDispatcherMap::iterator found = g_instance_to_dispatcher->find( - instance); - if (found != g_instance_to_dispatcher->end()) - g_instance_to_dispatcher->erase(found); + InstanceToHostDispatcherMap::iterator found = + g_instance_to_host_dispatcher->find(instance); + if (found != g_instance_to_host_dispatcher->end()) + g_instance_to_host_dispatcher->erase(found); } bool HostDispatcher::IsPlugin() const { diff --git a/chromium/ppapi/proxy/nacl_message_scanner.cc b/chromium/ppapi/proxy/nacl_message_scanner.cc index 4fae6974ee6..0e478c22149 100644 --- a/chromium/ppapi/proxy/nacl_message_scanner.cc +++ b/chromium/ppapi/proxy/nacl_message_scanner.cc @@ -213,10 +213,7 @@ void ScanTuple(std::tuple<A, B, C, D>&& t1, ScanningResults* results) { template <class MessageType> class MessageScannerImpl { public: - explicit MessageScannerImpl(const IPC::Message* msg) - // The cast below is invalid. See https://crbug.com/520760. - : msg_(static_cast<const MessageType*>(msg)) { - } + explicit MessageScannerImpl(const IPC::Message* msg) : msg_(msg) {} bool ScanMessage(ScanningResults* results) { typename MessageType::Param params; if (!MessageType::Read(msg_, ¶ms)) @@ -254,7 +251,7 @@ class MessageScannerImpl { } private: - const MessageType* msg_; + const IPC::Message* msg_; }; } // namespace diff --git a/chromium/ppapi/proxy/pdf_resource.cc b/chromium/ppapi/proxy/pdf_resource.cc index 75e0f3fe75e..90aaee28d1c 100644 --- a/chromium/ppapi/proxy/pdf_resource.cc +++ b/chromium/ppapi/proxy/pdf_resource.cc @@ -58,15 +58,16 @@ void PDFResource::SearchString(const unsigned short* input_string, PP_PrivateFindResult** results, uint32_t* count) { if (locale_.empty()) - locale_ = GetLocale(); + locale_ = GetLocale() + "@collation=search"; + const base::char16* string = reinterpret_cast<const base::char16*>(input_string); const base::char16* term = reinterpret_cast<const base::char16*>(input_term); UErrorCode status = U_ZERO_ERROR; - UStringSearch* searcher = usearch_open(term, -1, string, -1, locale_.c_str(), - 0, &status); + UStringSearch* searcher = + usearch_open(term, -1, string, -1, locale_.c_str(), nullptr, &status); DCHECK(status == U_ZERO_ERROR || status == U_USING_FALLBACK_WARNING || status == U_USING_DEFAULT_WARNING) << status; diff --git a/chromium/ppapi/proxy/pdf_resource_unittest.cc b/chromium/ppapi/proxy/pdf_resource_unittest.cc index 2787d68f6c2..507a2ca2797 100644 --- a/chromium/ppapi/proxy/pdf_resource_unittest.cc +++ b/chromium/ppapi/proxy/pdf_resource_unittest.cc @@ -32,7 +32,7 @@ TEST_F(PDFResourceTest, SearchString) { // Instantiate a resource explicitly so we can specify the locale. auto pdf_resource = base::MakeRefCounted<PDFResource>( Connection(&sink(), &sink(), 0), pp_instance()); - pdf_resource->SetLocaleForTest("en-US"); + pdf_resource->SetLocaleForTest("en-US@collation=search"); base::string16 input; base::string16 term; diff --git a/chromium/ppapi/proxy/plugin_dispatcher.cc b/chromium/ppapi/proxy/plugin_dispatcher.cc index 6bc240d2f43..67c9c3b2b6d 100644 --- a/chromium/ppapi/proxy/plugin_dispatcher.cc +++ b/chromium/ppapi/proxy/plugin_dispatcher.cc @@ -41,8 +41,8 @@ namespace proxy { namespace { -typedef std::map<PP_Instance, PluginDispatcher*> InstanceToDispatcherMap; -InstanceToDispatcherMap* g_instance_to_dispatcher = NULL; +typedef std::map<PP_Instance, PluginDispatcher*> InstanceToPluginDispatcherMap; +InstanceToPluginDispatcherMap* g_instance_to_plugin_dispatcher = NULL; typedef std::set<PluginDispatcher*> DispatcherSet; DispatcherSet* g_live_dispatchers = NULL; @@ -152,11 +152,11 @@ PluginDispatcher::~PluginDispatcher() { // static PluginDispatcher* PluginDispatcher::GetForInstance(PP_Instance instance) { - if (!g_instance_to_dispatcher) + if (!g_instance_to_plugin_dispatcher) return NULL; - InstanceToDispatcherMap::iterator found = g_instance_to_dispatcher->find( - instance); - if (found == g_instance_to_dispatcher->end()) + InstanceToPluginDispatcherMap::iterator found = + g_instance_to_plugin_dispatcher->find(instance); + if (found == g_instance_to_plugin_dispatcher->end()) return NULL; return found->second; } @@ -178,13 +178,13 @@ void PluginDispatcher::LogWithSource(PP_Instance instance, PP_LogLevel level, const std::string& source, const std::string& value) { - if (!g_live_dispatchers || !g_instance_to_dispatcher) + if (!g_live_dispatchers || !g_instance_to_plugin_dispatcher) return; if (instance) { - InstanceToDispatcherMap::iterator found = - g_instance_to_dispatcher->find(instance); - if (found != g_instance_to_dispatcher->end()) { + InstanceToPluginDispatcherMap::iterator found = + g_instance_to_plugin_dispatcher->find(instance); + if (found != g_instance_to_plugin_dispatcher->end()) { // Send just to this specific dispatcher. found->second->Send(new PpapiHostMsg_LogWithSource( instance, static_cast<int>(level), source, value)); @@ -283,21 +283,21 @@ void PluginDispatcher::OnChannelError() { } void PluginDispatcher::DidCreateInstance(PP_Instance instance) { - if (!g_instance_to_dispatcher) - g_instance_to_dispatcher = new InstanceToDispatcherMap; - (*g_instance_to_dispatcher)[instance] = this; + if (!g_instance_to_plugin_dispatcher) + g_instance_to_plugin_dispatcher = new InstanceToPluginDispatcherMap; + (*g_instance_to_plugin_dispatcher)[instance] = this; instance_map_[instance] = std::make_unique<InstanceData>(); } void PluginDispatcher::DidDestroyInstance(PP_Instance instance) { instance_map_.erase(instance); - if (g_instance_to_dispatcher) { - InstanceToDispatcherMap::iterator found = g_instance_to_dispatcher->find( - instance); - if (found != g_instance_to_dispatcher->end()) { + if (g_instance_to_plugin_dispatcher) { + InstanceToPluginDispatcherMap::iterator found = + g_instance_to_plugin_dispatcher->find(instance); + if (found != g_instance_to_plugin_dispatcher->end()) { DCHECK(found->second == this); - g_instance_to_dispatcher->erase(found); + g_instance_to_plugin_dispatcher->erase(found); } else { NOTREACHED(); } @@ -322,13 +322,13 @@ thunk::ResourceCreationAPI* PluginDispatcher::GetResourceCreationAPI() { } void PluginDispatcher::ForceFreeAllInstances() { - if (!g_instance_to_dispatcher) + if (!g_instance_to_plugin_dispatcher) return; // Iterating will remove each item from the map, so we need to make a copy // to avoid things changing out from under is. - InstanceToDispatcherMap temp_map = *g_instance_to_dispatcher; - for (InstanceToDispatcherMap::iterator i = temp_map.begin(); + InstanceToPluginDispatcherMap temp_map = *g_instance_to_plugin_dispatcher; + for (InstanceToPluginDispatcherMap::iterator i = temp_map.begin(); i != temp_map.end(); ++i) { if (i->second == this) { // Synthesize an "instance destroyed" message, this will notify the diff --git a/chromium/ppapi/proxy/plugin_resource.cc b/chromium/ppapi/proxy/plugin_resource.cc index 177012dd0ba..71283182dc7 100644 --- a/chromium/ppapi/proxy/plugin_resource.cc +++ b/chromium/ppapi/proxy/plugin_resource.cc @@ -13,6 +13,14 @@ namespace ppapi { namespace proxy { +void SafeRunCallback(scoped_refptr<TrackedCallback>* callback, int32_t error) { + if (TrackedCallback::IsPending(*callback)) { + scoped_refptr<TrackedCallback> temp; + callback->swap(temp); + temp->Run(error); + } +} + PluginResource::PluginResource(Connection connection, PP_Instance instance) : Resource(OBJECT_IS_PROXY, instance), connection_(connection), diff --git a/chromium/ppapi/proxy/plugin_resource.h b/chromium/ppapi/proxy/plugin_resource.h index 8f32277aea0..54aa2b5352c 100644 --- a/chromium/ppapi/proxy/plugin_resource.h +++ b/chromium/ppapi/proxy/plugin_resource.h @@ -26,6 +26,10 @@ namespace ppapi { namespace proxy { +// A "safe" way to run callbacks, doing nothing if they are not +// pending (active). +void SafeRunCallback(scoped_refptr<TrackedCallback>* callback, int32_t error); + class PPAPI_PROXY_EXPORT PluginResource : public Resource { public: enum Destination { diff --git a/chromium/ppapi/proxy/ppapi_command_buffer_proxy.cc b/chromium/ppapi/proxy/ppapi_command_buffer_proxy.cc index 90f4147bd1f..5c1ba7035af 100644 --- a/chromium/ppapi/proxy/ppapi_command_buffer_proxy.cc +++ b/chromium/ppapi/proxy/ppapi_command_buffer_proxy.cc @@ -252,8 +252,7 @@ const gpu::Capabilities& PpapiCommandBufferProxy::GetCapabilities() const { int32_t PpapiCommandBufferProxy::CreateImage(ClientBuffer buffer, size_t width, - size_t height, - unsigned internalformat) { + size_t height) { NOTREACHED(); return -1; } diff --git a/chromium/ppapi/proxy/ppapi_command_buffer_proxy.h b/chromium/ppapi/proxy/ppapi_command_buffer_proxy.h index 28588f265af..e2f137cab53 100644 --- a/chromium/ppapi/proxy/ppapi_command_buffer_proxy.h +++ b/chromium/ppapi/proxy/ppapi_command_buffer_proxy.h @@ -59,8 +59,7 @@ class PPAPI_PROXY_EXPORT PpapiCommandBufferProxy : public gpu::CommandBuffer, const gpu::Capabilities& GetCapabilities() const override; int32_t CreateImage(ClientBuffer buffer, size_t width, - size_t height, - unsigned internalformat) override; + size_t height) override; void DestroyImage(int32_t id) override; void SignalQuery(uint32_t query, base::OnceClosure callback) override; void CreateGpuFence(uint32_t gpu_fence_id, ClientGpuFence source) override; diff --git a/chromium/ppapi/proxy/ppapi_messages.cc b/chromium/ppapi/proxy/ppapi_messages.cc index 8ff3a9ddeee..a0c0991131a 100644 --- a/chromium/ppapi/proxy/ppapi_messages.cc +++ b/chromium/ppapi/proxy/ppapi_messages.cc @@ -18,14 +18,6 @@ #error "Failed to include ppapi/proxy/ppapi_messages.h" #endif -// Generate destructors. -#include "ipc/struct_destructor_macros.h" -#undef PPAPI_PROXY_PPAPI_MESSAGES_H_ -#include "ppapi/proxy/ppapi_messages.h" -#ifndef PPAPI_PROXY_PPAPI_MESSAGES_H_ -#error "Failed to include ppapi/proxy/ppapi_messages.h" -#endif - // Generate param traits write methods. #include "ipc/param_traits_write_macros.h" namespace IPC { diff --git a/chromium/ppapi/proxy/video_decoder_resource.cc b/chromium/ppapi/proxy/video_decoder_resource.cc index bcd60561198..94548e14d64 100644 --- a/chromium/ppapi/proxy/video_decoder_resource.cc +++ b/chromium/ppapi/proxy/video_decoder_resource.cc @@ -523,11 +523,7 @@ void VideoDecoderResource::OnPluginMsgResetComplete( void VideoDecoderResource::RunCallbackWithError( scoped_refptr<TrackedCallback>* callback) { - if (TrackedCallback::IsPending(*callback)) { - scoped_refptr<TrackedCallback> temp; - callback->swap(temp); - temp->Run(decoder_last_error_); - } + SafeRunCallback(callback, decoder_last_error_); } void VideoDecoderResource::DeleteGLTexture(uint32_t id) { diff --git a/chromium/ppapi/proxy/video_encoder_resource.cc b/chromium/ppapi/proxy/video_encoder_resource.cc index 1abb315aee3..eef9ea938f9 100644 --- a/chromium/ppapi/proxy/video_encoder_resource.cc +++ b/chromium/ppapi/proxy/video_encoder_resource.cc @@ -26,15 +26,6 @@ namespace proxy { namespace { -void RunCallback(scoped_refptr<TrackedCallback>* callback, int32_t error) { - if (!TrackedCallback::IsPending(*callback)) - return; - - scoped_refptr<TrackedCallback> temp; - callback->swap(temp); - temp->Run(error); -} - std::vector<PP_VideoProfileDescription_0_1> PP_VideoProfileDescriptionTo_0_1( std::vector<PP_VideoProfileDescription> profiles) { std::vector<PP_VideoProfileDescription_0_1> profiles_0_1; @@ -299,7 +290,7 @@ void VideoEncoderResource::OnPluginMsgGetSupportedProfilesReply( ArrayWriter writer(output); if (!writer.is_valid()) { - RunCallback(&get_supported_profiles_callback_, PP_ERROR_BADARGUMENT); + SafeRunCallback(&get_supported_profiles_callback_, PP_ERROR_BADARGUMENT); return; } @@ -311,12 +302,12 @@ void VideoEncoderResource::OnPluginMsgGetSupportedProfilesReply( write_result = writer.StoreVector(profiles); if (!write_result) { - RunCallback(&get_supported_profiles_callback_, PP_ERROR_FAILED); + SafeRunCallback(&get_supported_profiles_callback_, PP_ERROR_FAILED); return; } - RunCallback(&get_supported_profiles_callback_, - base::checked_cast<int32_t>(profiles.size())); + SafeRunCallback(&get_supported_profiles_callback_, + base::checked_cast<int32_t>(profiles.size())); } void VideoEncoderResource::OnPluginMsgInitializeReply( @@ -332,7 +323,7 @@ void VideoEncoderResource::OnPluginMsgInitializeReply( input_frame_count_ = input_frame_count; input_coded_size_ = input_coded_size; - RunCallback(&initialize_callback_, encoder_last_error_); + SafeRunCallback(&initialize_callback_, encoder_last_error_); } void VideoEncoderResource::OnPluginMsgGetVideoFramesReply( @@ -377,7 +368,7 @@ void VideoEncoderResource::OnPluginMsgEncodeReply( scoped_refptr<TrackedCallback> callback = it->second; encode_callbacks_.erase(it); - RunCallback(&callback, encoder_last_error_); + SafeRunCallback(&callback, encoder_last_error_); buffer_manager_.EnqueueBuffer(frame_id); // If the plugin is waiting for a video frame, we can give the one @@ -431,16 +422,16 @@ void VideoEncoderResource::OnPluginMsgNotifyError( void VideoEncoderResource::NotifyError(int32_t error) { encoder_last_error_ = error; - RunCallback(&get_supported_profiles_callback_, error); - RunCallback(&initialize_callback_, error); - RunCallback(&get_video_frame_callback_, error); + SafeRunCallback(&get_supported_profiles_callback_, error); + SafeRunCallback(&initialize_callback_, error); + SafeRunCallback(&get_video_frame_callback_, error); get_video_frame_data_ = nullptr; - RunCallback(&get_bitstream_buffer_callback_, error); + SafeRunCallback(&get_bitstream_buffer_callback_, error); get_bitstream_buffer_data_ = nullptr; for (EncodeMap::iterator it = encode_callbacks_.begin(); it != encode_callbacks_.end(); ++it) { scoped_refptr<TrackedCallback> callback = it->second; - RunCallback(&callback, error); + SafeRunCallback(&callback, error); } encode_callbacks_.clear(); } @@ -459,7 +450,7 @@ void VideoEncoderResource::TryWriteVideoFrame() { *get_video_frame_data_ = resource->GetReference(); get_video_frame_data_ = nullptr; - RunCallback(&get_video_frame_callback_, PP_OK); + SafeRunCallback(&get_video_frame_callback_, PP_OK); } void VideoEncoderResource::WriteBitstreamBuffer(const BitstreamBuffer& buffer) { @@ -469,7 +460,7 @@ void VideoEncoderResource::WriteBitstreamBuffer(const BitstreamBuffer& buffer) { get_bitstream_buffer_data_->buffer = shm_buffers_[buffer.id]->shm->memory(); get_bitstream_buffer_data_->key_frame = PP_FromBool(buffer.key_frame); get_bitstream_buffer_data_ = nullptr; - RunCallback(&get_bitstream_buffer_callback_, PP_OK); + SafeRunCallback(&get_bitstream_buffer_callback_, PP_OK); } void VideoEncoderResource::ReleaseFrames() { diff --git a/chromium/ppapi/shared_impl/BUILD.gn b/chromium/ppapi/shared_impl/BUILD.gn index c60f43ad102..edddfc8b00b 100644 --- a/chromium/ppapi/shared_impl/BUILD.gn +++ b/chromium/ppapi/shared_impl/BUILD.gn @@ -2,9 +2,10 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/jumbo.gni") import("//build/config/nacl/config.gni") -component("shared_impl") { +jumbo_component("shared_impl") { output_name = "ppapi_shared" sources = [ diff --git a/chromium/ppapi/shared_impl/private/ppb_char_set_shared.cc b/chromium/ppapi/shared_impl/private/ppb_char_set_shared.cc index 9761c3899e5..e203c6f9c62 100644 --- a/chromium/ppapi/shared_impl/private/ppb_char_set_shared.cc +++ b/chromium/ppapi/shared_impl/private/ppb_char_set_shared.cc @@ -113,15 +113,15 @@ PP_Bool PPB_CharSet_Shared::UTF16ToCharSet( // Setup our error handler. switch (on_error) { - case PP_CHARSET_CONVERSIONERROR_FAIL: + case PP_CHARSET_TRUSTED_CONVERSIONERROR_FAIL: ucnv_setFromUCallBack(converter, UCNV_FROM_U_CALLBACK_STOP, 0, NULL, NULL, &status); break; - case PP_CHARSET_CONVERSIONERROR_SKIP: + case PP_CHARSET_TRUSTED_CONVERSIONERROR_SKIP: ucnv_setFromUCallBack(converter, UCNV_FROM_U_CALLBACK_SKIP, 0, NULL, NULL, &status); break; - case PP_CHARSET_CONVERSIONERROR_SUBSTITUTE: { + case PP_CHARSET_TRUSTED_CONVERSIONERROR_SUBSTITUTE: { // ICU sets the substitution char for some character sets (like latin1) // to be the ASCII "substitution character" (26). We want to use '?' // instead for backwards-compat with Windows behavior. diff --git a/chromium/ppapi/utility/threading/lock.h b/chromium/ppapi/utility/threading/lock.h index f3bfe4adebd..fefe3210e41 100644 --- a/chromium/ppapi/utility/threading/lock.h +++ b/chromium/ppapi/utility/threading/lock.h @@ -7,6 +7,9 @@ #ifdef WIN32 #include <windows.h> +// MemoryBarrier is a Win32 macro that clashes with MemoryBarrier in +// base/atomicops.h. +#undef MemoryBarrier #else #include <pthread.h> #endif diff --git a/chromium/ppapi/utility/threading/simple_thread.h b/chromium/ppapi/utility/threading/simple_thread.h index b4d7114cc4e..d10c8599654 100644 --- a/chromium/ppapi/utility/threading/simple_thread.h +++ b/chromium/ppapi/utility/threading/simple_thread.h @@ -8,6 +8,9 @@ #include <stddef.h> #ifdef WIN32 #include <windows.h> +// MemoryBarrier is a Win32 macro that clashes with MemoryBarrier in +// base/atomicops.h. +#undef MemoryBarrier #else #include <pthread.h> #endif |