Commit da3d09f9 authored by Gyuyoung Kim's avatar Gyuyoung Kim Committed by Commit Bot

Inline static Create() factory functions from renderer/modules/mediarecorder

This CL removes Create() factory functions in
//third_party/blink/renderer/modules/mediarecorder as much as possible,
and makes all callers use MakeGarbageCollected<Foo> instead.

This CL removes below factory functions,
  - BlobEvent::Create(const AtomicString& type, Blob* blob, double timecode)
  - MediaRecorderHandler::Create

Bug: 939691
Change-Id: I82450514fab5bf2c5667fbdb5b7930d4cc02a6aa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1949839Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarGuido Urdaneta <guidou@chromium.org>
Commit-Queue: Gyuyoung Kim <gyuyoung@igalia.com>
Cr-Commit-Position: refs/heads/master@{#721423}
parent 499d1321
...@@ -647,7 +647,7 @@ ScriptPromise MediaCapabilities::encodingInfo( ...@@ -647,7 +647,7 @@ ScriptPromise MediaCapabilities::encodingInfo(
} }
if (configuration->type() == "record") { if (configuration->type() == "record") {
if (auto* handler = MediaRecorderHandler::Create( if (auto* handler = MakeGarbageCollected<MediaRecorderHandler>(
ExecutionContext::From(script_state) ExecutionContext::From(script_state)
->GetTaskRunner(TaskType::kInternalMediaRealTime))) { ->GetTaskRunner(TaskType::kInternalMediaRealTime))) {
handler->EncodingInfo(ToWebMediaConfiguration(configuration), handler->EncodingInfo(ToWebMediaConfiguration(configuration),
......
...@@ -16,13 +16,6 @@ BlobEvent* BlobEvent::Create(const AtomicString& type, ...@@ -16,13 +16,6 @@ BlobEvent* BlobEvent::Create(const AtomicString& type,
return MakeGarbageCollected<BlobEvent>(type, initializer); return MakeGarbageCollected<BlobEvent>(type, initializer);
} }
// static
BlobEvent* BlobEvent::Create(const AtomicString& type,
Blob* blob,
double timecode) {
return MakeGarbageCollected<BlobEvent>(type, blob, timecode);
}
const AtomicString& BlobEvent::InterfaceName() const { const AtomicString& BlobEvent::InterfaceName() const {
return event_interface_names::kBlobEvent; return event_interface_names::kBlobEvent;
} }
......
...@@ -24,9 +24,6 @@ class MODULES_EXPORT BlobEvent final : public Event { ...@@ -24,9 +24,6 @@ class MODULES_EXPORT BlobEvent final : public Event {
static BlobEvent* Create(const AtomicString& type, static BlobEvent* Create(const AtomicString& type,
const BlobEventInit* initializer); const BlobEventInit* initializer);
static BlobEvent* Create(const AtomicString& type,
Blob* blob,
double timecode);
BlobEvent(const AtomicString& type, const BlobEventInit* initializer); BlobEvent(const AtomicString& type, const BlobEventInit* initializer);
BlobEvent(const AtomicString& type, Blob* blob, double timecode); BlobEvent(const AtomicString& type, Blob* blob, double timecode);
......
...@@ -172,7 +172,7 @@ MediaRecorder::MediaRecorder(ExecutionContext* context, ...@@ -172,7 +172,7 @@ MediaRecorder::MediaRecorder(ExecutionContext* context,
"Execution context is detached."); "Execution context is detached.");
return; return;
} }
recorder_handler_ = MediaRecorderHandler::Create( recorder_handler_ = MakeGarbageCollected<MediaRecorderHandler>(
context->GetTaskRunner(TaskType::kInternalMediaRealTime)); context->GetTaskRunner(TaskType::kInternalMediaRealTime));
if (!recorder_handler_) { if (!recorder_handler_) {
exception_state.ThrowDOMException( exception_state.ThrowDOMException(
...@@ -324,7 +324,7 @@ void MediaRecorder::requestData(ExceptionState& exception_state) { ...@@ -324,7 +324,7 @@ void MediaRecorder::requestData(ExceptionState& exception_state) {
bool MediaRecorder::isTypeSupported(ExecutionContext* context, bool MediaRecorder::isTypeSupported(ExecutionContext* context,
const String& type) { const String& type) {
MediaRecorderHandler* handler = MediaRecorderHandler::Create( MediaRecorderHandler* handler = MakeGarbageCollected<MediaRecorderHandler>(
context->GetTaskRunner(TaskType::kInternalMediaRealTime)); context->GetTaskRunner(TaskType::kInternalMediaRealTime));
if (!handler) if (!handler)
return false; return false;
......
...@@ -106,11 +106,6 @@ AudioTrackRecorder::CodecId AudioStringToCodecId(const String& codecs) { ...@@ -106,11 +106,6 @@ AudioTrackRecorder::CodecId AudioStringToCodecId(const String& codecs) {
} // anonymous namespace } // anonymous namespace
MediaRecorderHandler* MediaRecorderHandler::Create(
scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
return MakeGarbageCollected<MediaRecorderHandler>(std::move(task_runner));
}
MediaRecorderHandler::MediaRecorderHandler( MediaRecorderHandler::MediaRecorderHandler(
scoped_refptr<base::SingleThreadTaskRunner> task_runner) scoped_refptr<base::SingleThreadTaskRunner> task_runner)
: video_bits_per_second_(0), : video_bits_per_second_(0),
......
...@@ -45,9 +45,6 @@ struct WebMediaConfiguration; ...@@ -45,9 +45,6 @@ struct WebMediaConfiguration;
class MODULES_EXPORT MediaRecorderHandler final class MODULES_EXPORT MediaRecorderHandler final
: public GarbageCollected<MediaRecorderHandler> { : public GarbageCollected<MediaRecorderHandler> {
public: public:
static MediaRecorderHandler* Create(
scoped_refptr<base::SingleThreadTaskRunner> task_runner);
explicit MediaRecorderHandler( explicit MediaRecorderHandler(
scoped_refptr<base::SingleThreadTaskRunner> task_runner); scoped_refptr<base::SingleThreadTaskRunner> task_runner);
~MediaRecorderHandler(); ~MediaRecorderHandler();
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "third_party/blink/renderer/modules/mediarecorder/media_recorder_handler.h" #include "third_party/blink/renderer/modules/mediarecorder/media_recorder_handler.h"
#include "third_party/blink/renderer/modules/mediastream/mock_media_stream_registry.h" #include "third_party/blink/renderer/modules/mediastream/mock_media_stream_registry.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/heap/heap.h"
#include "third_party/blink/renderer/platform/heap/thread_state.h" #include "third_party/blink/renderer/platform/heap/thread_state.h"
#include "third_party/blink/renderer/platform/testing/io_task_runner_testing_platform_support.h" #include "third_party/blink/renderer/platform/testing/io_task_runner_testing_platform_support.h"
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
...@@ -106,7 +107,7 @@ class MockMediaRecorder : public MediaRecorder { ...@@ -106,7 +107,7 @@ class MockMediaRecorder : public MediaRecorder {
class MediaRecorderHandlerTest : public TestWithParam<MediaRecorderTestParams> { class MediaRecorderHandlerTest : public TestWithParam<MediaRecorderTestParams> {
public: public:
MediaRecorderHandlerTest() MediaRecorderHandlerTest()
: media_recorder_handler_(MediaRecorderHandler::Create( : media_recorder_handler_(MakeGarbageCollected<MediaRecorderHandler>(
scheduler::GetSingleThreadTaskRunnerForTesting())), scheduler::GetSingleThreadTaskRunnerForTesting())),
audio_source_(kTestAudioChannels, audio_source_(kTestAudioChannels,
440 /* freq */, 440 /* freq */,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment