|
@@ -0,0 +1,174 @@
|
|
|
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
+From: Chris Cunningham <[email protected]>
|
|
|
+Date: Tue, 5 Jan 2021 21:23:21 +0000
|
|
|
+Subject: MediaCapabilities: Use threadsafe static wtf::String
|
|
|
+
|
|
|
+This replaces DEFINE_THREAD_SAFE_STATIC_LOCAL(const String, ...).
|
|
|
+StringImpl ref counting (behind that macro) is not currently threadsafe.
|
|
|
+
|
|
|
+(cherry picked from commit f9add3b8e53c440129f7be4a181a22c440e856bc)
|
|
|
+
|
|
|
+Bug: 1160534
|
|
|
+Change-Id: I70f4aa796aaefabbee36db4fcdf0fbf0defe4959
|
|
|
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2606399
|
|
|
+Commit-Queue: Chrome Cunningham <[email protected]>
|
|
|
+Reviewed-by: Jeremy Roman <[email protected]>
|
|
|
+Auto-Submit: Chrome Cunningham <[email protected]>
|
|
|
+Cr-Original-Commit-Position: refs/heads/master@{#839863}
|
|
|
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2611646
|
|
|
+Reviewed-by: Chrome Cunningham <[email protected]>
|
|
|
+Cr-Commit-Position: refs/branch-heads/4324@{#1460}
|
|
|
+Cr-Branched-From: c73b5a651d37a6c4d0b8e3262cc4015a5579c6c8-refs/heads/master@{#827102}
|
|
|
+
|
|
|
+diff --git a/third_party/blink/renderer/modules/BUILD.gn b/third_party/blink/renderer/modules/BUILD.gn
|
|
|
+index 762f66ac93801aef52abb289fd45b4545eed3984..c9ebc5c5fa5ab147716f2d5031ca197b9e5fa3d4 100644
|
|
|
+--- a/third_party/blink/renderer/modules/BUILD.gn
|
|
|
++++ b/third_party/blink/renderer/modules/BUILD.gn
|
|
|
+@@ -21,12 +21,18 @@ config("modules_implementation") {
|
|
|
+ defines = [ "BLINK_MODULES_IMPLEMENTATION=1" ]
|
|
|
+ }
|
|
|
+
|
|
|
+-make_names("module_names") {
|
|
|
++make_names("indexed_db_names") {
|
|
|
+ in_files = [ "indexeddb/indexed_db_names.json5" ]
|
|
|
+ output_dir = blink_modules_output_dir
|
|
|
+ deps = [] # Don't use default deps (otherwise it will be circular).
|
|
|
+ }
|
|
|
+
|
|
|
++make_names("media_capabilities_names") {
|
|
|
++ in_files = [ "media_capabilities/media_capabilities_names.json5" ]
|
|
|
++ output_dir = blink_modules_output_dir
|
|
|
++ deps = [] # Don't use default deps (otherwise it will be circular).
|
|
|
++}
|
|
|
++
|
|
|
+ jumbo_component("modules") {
|
|
|
+ output_name = "blink_modules"
|
|
|
+
|
|
|
+@@ -42,8 +48,9 @@ jumbo_component("modules") {
|
|
|
+ "modules_initializer.h",
|
|
|
+ ]
|
|
|
+
|
|
|
+- # Compile sources generated by module_names script.
|
|
|
+- sources += get_target_outputs(":module_names")
|
|
|
++ # Compile sources generated by make_names script.
|
|
|
++ sources += get_target_outputs(":indexed_db_names")
|
|
|
++ sources += get_target_outputs(":media_capabilities_names")
|
|
|
+
|
|
|
+ sources += bindings_modules_v8_files
|
|
|
+ sources += rebase_path(
|
|
|
+@@ -162,8 +169,9 @@ jumbo_component("modules") {
|
|
|
+ }
|
|
|
+
|
|
|
+ deps = [
|
|
|
++ ":indexed_db_names",
|
|
|
+ ":make_modules_generated",
|
|
|
+- ":module_names",
|
|
|
++ ":media_capabilities_names",
|
|
|
+ "//jingle:webrtc_glue",
|
|
|
+ "//net:net",
|
|
|
+ "//third_party/blink/renderer/bindings/modules:generated",
|
|
|
+@@ -244,7 +252,8 @@ jumbo_source_set("modules_testing") {
|
|
|
+
|
|
|
+ group("make_modules_generated") {
|
|
|
+ public_deps = [
|
|
|
+- ":module_names",
|
|
|
++ ":indexed_db_names",
|
|
|
++ ":media_capabilities_names",
|
|
|
+ "//third_party/blink/renderer/bindings/modules:bindings_modules_generated",
|
|
|
+ "//third_party/blink/renderer/core:core_event_interfaces",
|
|
|
+ ]
|
|
|
+diff --git a/third_party/blink/renderer/modules/media_capabilities/DEPS b/third_party/blink/renderer/modules/media_capabilities/DEPS
|
|
|
+index 02607e024edca35dc53414b9e7fad33191e052c7..25cac8b1965638cec4b8c4c264ce0d0de1010bef 100644
|
|
|
+--- a/third_party/blink/renderer/modules/media_capabilities/DEPS
|
|
|
++++ b/third_party/blink/renderer/modules/media_capabilities/DEPS
|
|
|
+@@ -10,6 +10,7 @@ include_rules = [
|
|
|
+ "-third_party/blink/renderer/modules",
|
|
|
+ "+third_party/blink/renderer/modules/encryptedmedia",
|
|
|
+ "+third_party/blink/renderer/modules/media_capabilities",
|
|
|
++ "+third_party/blink/renderer/modules/media_capabilities_names.h",
|
|
|
+ "+third_party/blink/renderer/modules/mediarecorder/media_recorder_handler.h",
|
|
|
+ "+third_party/blink/renderer/modules/modules_export.h",
|
|
|
+ ]
|
|
|
+diff --git a/third_party/blink/renderer/modules/media_capabilities/media_capabilities.cc b/third_party/blink/renderer/modules/media_capabilities/media_capabilities.cc
|
|
|
+index 717318e8d68bf1bc7a3ddc07291754da0c452060..e19680cdb2002d31c7a4cf9c000ae4cf74c0d2f2 100644
|
|
|
+--- a/third_party/blink/renderer/modules/media_capabilities/media_capabilities.cc
|
|
|
++++ b/third_party/blink/renderer/modules/media_capabilities/media_capabilities.cc
|
|
|
+@@ -47,6 +47,7 @@
|
|
|
+ #include "third_party/blink/renderer/modules/encryptedmedia/media_key_system_access.h"
|
|
|
+ #include "third_party/blink/renderer/modules/encryptedmedia/media_key_system_access_initializer_base.h"
|
|
|
+ #include "third_party/blink/renderer/modules/encryptedmedia/media_keys_controller.h"
|
|
|
++#include "third_party/blink/renderer/modules/media_capabilities_names.h"
|
|
|
+ #include "third_party/blink/renderer/modules/mediarecorder/media_recorder_handler.h"
|
|
|
+ #include "third_party/blink/renderer/platform/bindings/exception_state.h"
|
|
|
+ #include "third_party/blink/renderer/platform/bindings/script_state.h"
|
|
|
+@@ -260,9 +261,9 @@ WebAudioConfiguration ToWebAudioConfiguration(
|
|
|
+ DCHECK(parsed_content_type.IsValid());
|
|
|
+ DCHECK(!parsed_content_type.GetParameters().HasDuplicatedNames());
|
|
|
+
|
|
|
+- DEFINE_THREAD_SAFE_STATIC_LOCAL(const String, codecs, ("codecs"));
|
|
|
+ web_configuration.mime_type = parsed_content_type.MimeType().LowerASCII();
|
|
|
+- web_configuration.codec = parsed_content_type.ParameterValueForName(codecs);
|
|
|
++ web_configuration.codec = parsed_content_type.ParameterValueForName(
|
|
|
++ media_capabilities_names::kCodecs);
|
|
|
+
|
|
|
+ // |channels| is optional and will be set to a null WebString if not present.
|
|
|
+ web_configuration.channels = configuration->hasChannels()
|
|
|
+@@ -288,9 +289,9 @@ WebVideoConfiguration ToWebVideoConfiguration(
|
|
|
+ DCHECK(parsed_content_type.IsValid());
|
|
|
+ DCHECK(!parsed_content_type.GetParameters().HasDuplicatedNames());
|
|
|
+
|
|
|
+- DEFINE_THREAD_SAFE_STATIC_LOCAL(const String, codecs, ("codecs"));
|
|
|
+ web_configuration.mime_type = parsed_content_type.MimeType().LowerASCII();
|
|
|
+- web_configuration.codec = parsed_content_type.ParameterValueForName(codecs);
|
|
|
++ web_configuration.codec = parsed_content_type.ParameterValueForName(
|
|
|
++ media_capabilities_names::kCodecs);
|
|
|
+
|
|
|
+ DCHECK(configuration->hasWidth());
|
|
|
+ web_configuration.width = configuration->width();
|
|
|
+@@ -495,9 +496,9 @@ bool ParseContentType(const String& content_type,
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+- DEFINE_THREAD_SAFE_STATIC_LOCAL(const String, codecs, ("codecs"));
|
|
|
+ *mime_type = parsed_content_type.MimeType().LowerASCII();
|
|
|
+- *codec = parsed_content_type.ParameterValueForName(codecs);
|
|
|
++ *codec = parsed_content_type.ParameterValueForName(
|
|
|
++ media_capabilities_names::kCodecs);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+diff --git a/third_party/blink/renderer/modules/media_capabilities/media_capabilities_names.json5 b/third_party/blink/renderer/modules/media_capabilities/media_capabilities_names.json5
|
|
|
+new file mode 100644
|
|
|
+index 0000000000000000000000000000000000000000..01f9a0f705da3fad7708cccbd22c9a8c1789ff0c
|
|
|
+--- /dev/null
|
|
|
++++ b/third_party/blink/renderer/modules/media_capabilities/media_capabilities_names.json5
|
|
|
+@@ -0,0 +1,9 @@
|
|
|
++{
|
|
|
++ metadata: {
|
|
|
++ namespace: "media_capabilities_names",
|
|
|
++ },
|
|
|
++
|
|
|
++ data: [
|
|
|
++ "codecs",
|
|
|
++ ],
|
|
|
++}
|
|
|
+diff --git a/third_party/blink/renderer/modules/modules_initializer.cc b/third_party/blink/renderer/modules/modules_initializer.cc
|
|
|
+index f67d07600d05e99e31bfb58a99c28cedf69293da..521d64395b54d964571445d9a7c537d1aef2eb8e 100644
|
|
|
+--- a/third_party/blink/renderer/modules/modules_initializer.cc
|
|
|
++++ b/third_party/blink/renderer/modules/modules_initializer.cc
|
|
|
+@@ -62,6 +62,7 @@
|
|
|
+ #include "third_party/blink/renderer/modules/launch/file_handling_expiry_impl.h"
|
|
|
+ #include "third_party/blink/renderer/modules/launch/web_launch_service_impl.h"
|
|
|
+ #include "third_party/blink/renderer/modules/manifest/manifest_manager.h"
|
|
|
++#include "third_party/blink/renderer/modules/media_capabilities_names.h"
|
|
|
+ #include "third_party/blink/renderer/modules/media_controls/media_controls_impl.h"
|
|
|
+ #include "third_party/blink/renderer/modules/mediastream/user_media_client.h"
|
|
|
+ #include "third_party/blink/renderer/modules/mediastream/user_media_controller.h"
|
|
|
+@@ -119,6 +120,7 @@ void ModulesInitializer::Initialize() {
|
|
|
+ Document::RegisterEventFactory(EventModulesFactory::Create());
|
|
|
+ ModuleBindingsInitializer::Init();
|
|
|
+ indexed_db_names::Init();
|
|
|
++ media_capabilities_names::Init();
|
|
|
+ AXObjectCache::Init(AXObjectCacheImpl::Create);
|
|
|
+ DraggedIsolatedFileSystem::Init(
|
|
|
+ DraggedIsolatedFileSystemImpl::PrepareForDataObject);
|