Commit 60fedd2e authored by Richard Stotz's avatar Richard Stotz Committed by Chromium LUCI CQ

NativeIO: Rename NativeIOManager to NativeIOFileManager in Blink

After https://crrev.com/c/2588910 introduced a NativeIOManager in
content/browser, this CL renames Blink's NativeIOManager to
NativeIOFileManager to avoid future confusion.

No functional changes are introduced.

Bug: 1137788
Change-Id: I190ec89ac33864ce347374a33a0d6e57cb21f434
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2593374Reviewed-by: default avatarMike West <mkwst@chromium.org>
Commit-Queue: Richard Stotz <rstz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#837996}
parent eaa5b11d
......@@ -1749,10 +1749,10 @@ generated_interface_sources_in_modules = [
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_native_file_system_directory_iterator.h",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_native_io_file.cc",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_native_io_file.h",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_native_io_file_manager.cc",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_native_io_file_manager.h",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_native_io_file_sync.cc",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_native_io_file_sync.h",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_native_io_manager.cc",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_native_io_manager.h",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_navigation_preload_manager.cc",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_navigation_preload_manager.h",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_navigator.cc",
......
......@@ -400,8 +400,8 @@ static_idl_files_in_modules = get_path_info(
"//third_party/blink/renderer/modules/mediastream/navigator_user_media.idl",
"//third_party/blink/renderer/modules/mediastream/overconstrained_error.idl",
"//third_party/blink/renderer/modules/native_io/native_io_file.idl",
"//third_party/blink/renderer/modules/native_io/native_io_file_manager.idl",
"//third_party/blink/renderer/modules/native_io/native_io_file_sync.idl",
"//third_party/blink/renderer/modules/native_io/native_io_manager.idl",
"//third_party/blink/renderer/modules/native_io/window_native_io.idl",
"//third_party/blink/renderer/modules/native_io/worker_global_scope_native_io.idl",
"//third_party/blink/renderer/modules/navigatorcontentutils/navigator_content_utils.idl",
......
......@@ -12,10 +12,10 @@ blink_modules_sources("native_io") {
"native_io_error.h",
"native_io_file.cc",
"native_io_file.h",
"native_io_file_manager.cc",
"native_io_file_manager.h",
"native_io_file_sync.cc",
"native_io_file_sync.h",
"native_io_manager.cc",
"native_io_manager.h",
]
deps = [ "//third_party/blink/renderer/platform" ]
......
......@@ -13,7 +13,7 @@
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/workers/worker_global_scope.h"
#include "third_party/blink/renderer/modules/native_io/native_io_manager.h"
#include "third_party/blink/renderer/modules/native_io/native_io_file_manager.h"
#include "third_party/blink/renderer/platform/heap/handle.h"
#include "third_party/blink/renderer/platform/mojo/heap_mojo_remote.h"
#include "third_party/blink/renderer/platform/supplementable.h"
......@@ -41,8 +41,8 @@ class GlobalNativeIOImpl final : public GarbageCollected<GlobalNativeIOImpl<T>>,
explicit GlobalNativeIOImpl(T& supplementable)
: Supplement<T>(supplementable) {}
NativeIOManager* GetNativeIOManager(T& scope) {
if (!native_io_manager_) {
NativeIOFileManager* GetNativeIOFileManager(T& scope) {
if (!native_io_file_manager_) {
ExecutionContext* execution_context = scope.GetExecutionContext();
if (&execution_context->GetBrowserInterfaceBroker() ==
&GetEmptyBrowserInterfaceBroker()) {
......@@ -53,19 +53,19 @@ class GlobalNativeIOImpl final : public GarbageCollected<GlobalNativeIOImpl<T>>,
execution_context->GetBrowserInterfaceBroker().GetInterface(
backend.BindNewPipeAndPassReceiver(
execution_context->GetTaskRunner(TaskType::kMiscPlatformAPI)));
native_io_manager_ = MakeGarbageCollected<NativeIOManager>(
native_io_file_manager_ = MakeGarbageCollected<NativeIOFileManager>(
execution_context, std::move(backend));
}
return native_io_manager_;
return native_io_file_manager_;
}
void Trace(Visitor* visitor) const override {
visitor->Trace(native_io_manager_);
visitor->Trace(native_io_file_manager_);
Supplement<T>::Trace(visitor);
}
private:
Member<NativeIOManager> native_io_manager_;
Member<NativeIOFileManager> native_io_file_manager_;
};
// static
......@@ -75,15 +75,15 @@ const char GlobalNativeIOImpl<T>::kSupplementName[] = "GlobalNativeIOImpl";
} // namespace
// static
NativeIOManager* GlobalNativeIO::nativeIO(LocalDOMWindow& window) {
return GlobalNativeIOImpl<LocalDOMWindow>::From(window).GetNativeIOManager(
window);
NativeIOFileManager* GlobalNativeIO::nativeIO(LocalDOMWindow& window) {
return GlobalNativeIOImpl<LocalDOMWindow>::From(window)
.GetNativeIOFileManager(window);
}
// static
NativeIOManager* GlobalNativeIO::nativeIO(WorkerGlobalScope& worker) {
return GlobalNativeIOImpl<WorkerGlobalScope>::From(worker).GetNativeIOManager(
worker);
NativeIOFileManager* GlobalNativeIO::nativeIO(WorkerGlobalScope& worker) {
return GlobalNativeIOImpl<WorkerGlobalScope>::From(worker)
.GetNativeIOFileManager(worker);
}
} // namespace blink
......@@ -10,7 +10,7 @@
namespace blink {
class LocalDOMWindow;
class NativeIOManager;
class NativeIOFileManager;
class WorkerGlobalScope;
// The "nativeIO" attribute on the Window global and Worker global scope.
......@@ -18,8 +18,8 @@ class GlobalNativeIO {
STATIC_ONLY(GlobalNativeIO);
public:
static NativeIOManager* nativeIO(LocalDOMWindow&);
static NativeIOManager* nativeIO(WorkerGlobalScope&);
static NativeIOFileManager* nativeIO(LocalDOMWindow&);
static NativeIOFileManager* nativeIO(WorkerGlobalScope&);
};
} // namespace blink
......
......@@ -4,8 +4,8 @@
modules_idl_files = [
"native_io_file.idl",
"native_io_file_manager.idl",
"native_io_file_sync.idl",
"native_io_manager.idl",
]
modules_dependency_idl_files = [
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/renderer/modules/native_io/native_io_manager.h"
#include "third_party/blink/renderer/modules/native_io/native_io_file_manager.h"
#include <algorithm>
#include <utility>
......@@ -120,7 +120,7 @@ void OnRenameResult(ScriptPromiseResolver* resolver,
} // namespace
NativeIOManager::NativeIOManager(
NativeIOFileManager::NativeIOFileManager(
ExecutionContext* execution_context,
HeapMojoRemote<mojom::blink::NativeIOHost> backend)
: ExecutionContextClient(execution_context),
......@@ -129,14 +129,14 @@ NativeIOManager::NativeIOManager(
execution_context->GetTaskRunner(TaskType::kMiscPlatformAPI)),
backend_(std::move(backend)) {
backend_.set_disconnect_handler(WTF::Bind(
&NativeIOManager::OnBackendDisconnect, WrapWeakPersistent(this)));
&NativeIOFileManager::OnBackendDisconnect, WrapWeakPersistent(this)));
}
NativeIOManager::~NativeIOManager() = default;
NativeIOFileManager::~NativeIOFileManager() = default;
ScriptPromise NativeIOManager::open(ScriptState* script_state,
String name,
ExceptionState& exception_state) {
ScriptPromise NativeIOFileManager::open(ScriptState* script_state,
String name,
ExceptionState& exception_state) {
if (!IsValidNativeIOName(name)) {
exception_state.ThrowTypeError("Invalid file name");
return ScriptPromise();
......@@ -166,9 +166,9 @@ ScriptPromise NativeIOManager::open(ScriptState* script_state,
return resolver->Promise();
}
ScriptPromise NativeIOManager::Delete(ScriptState* script_state,
String name,
ExceptionState& exception_state) {
ScriptPromise NativeIOFileManager::Delete(ScriptState* script_state,
String name,
ExceptionState& exception_state) {
if (!IsValidNativeIOName(name)) {
exception_state.ThrowTypeError("Invalid file name");
return ScriptPromise();
......@@ -188,8 +188,8 @@ ScriptPromise NativeIOManager::Delete(ScriptState* script_state,
return resolver->Promise();
}
ScriptPromise NativeIOManager::getAll(ScriptState* script_state,
ExceptionState& exception_state) {
ScriptPromise NativeIOFileManager::getAll(ScriptState* script_state,
ExceptionState& exception_state) {
if (!backend_.is_bound()) {
ThrowNativeIOWithError(exception_state,
mojom::blink::NativeIOError::New(
......@@ -204,10 +204,10 @@ ScriptPromise NativeIOManager::getAll(ScriptState* script_state,
return resolver->Promise();
}
ScriptPromise NativeIOManager::rename(ScriptState* script_state,
String old_name,
String new_name,
ExceptionState& exception_state) {
ScriptPromise NativeIOFileManager::rename(ScriptState* script_state,
String old_name,
String new_name,
ExceptionState& exception_state) {
if (!IsValidNativeIOName(old_name) || !IsValidNativeIOName(new_name)) {
exception_state.ThrowTypeError("Invalid file name");
return ScriptPromise();
......@@ -227,8 +227,9 @@ ScriptPromise NativeIOManager::rename(ScriptState* script_state,
return resolver->Promise();
}
NativeIOFileSync* NativeIOManager::openSync(String name,
ExceptionState& exception_state) {
NativeIOFileSync* NativeIOFileManager::openSync(
String name,
ExceptionState& exception_state) {
if (!IsValidNativeIOName(name)) {
exception_state.ThrowTypeError("Invalid file name");
return nullptr;
......@@ -266,7 +267,8 @@ NativeIOFileSync* NativeIOManager::openSync(String name,
std::move(backing_file), std::move(backend_file), execution_context);
}
void NativeIOManager::deleteSync(String name, ExceptionState& exception_state) {
void NativeIOFileManager::deleteSync(String name,
ExceptionState& exception_state) {
if (!IsValidNativeIOName(name)) {
exception_state.ThrowTypeError("Invalid file name");
return;
......@@ -290,7 +292,8 @@ void NativeIOManager::deleteSync(String name, ExceptionState& exception_state) {
DCHECK(call_succeeded) << "Mojo call failed";
}
Vector<String> NativeIOManager::getAllSync(ExceptionState& exception_state) {
Vector<String> NativeIOFileManager::getAllSync(
ExceptionState& exception_state) {
Vector<String> result;
if (!backend_.is_bound()) {
ThrowNativeIOWithError(exception_state,
......@@ -311,9 +314,9 @@ Vector<String> NativeIOManager::getAllSync(ExceptionState& exception_state) {
return result;
}
void NativeIOManager::renameSync(String old_name,
String new_name,
ExceptionState& exception_state) {
void NativeIOFileManager::renameSync(String old_name,
String new_name,
ExceptionState& exception_state) {
if (!IsValidNativeIOName(old_name) || !IsValidNativeIOName(new_name)) {
exception_state.ThrowTypeError("Invalid file name");
return;
......@@ -338,13 +341,13 @@ void NativeIOManager::renameSync(String old_name,
DCHECK(call_succeeded) << "Mojo call failed";
}
void NativeIOManager::Trace(Visitor* visitor) const {
void NativeIOFileManager::Trace(Visitor* visitor) const {
visitor->Trace(backend_);
ScriptWrappable::Trace(visitor);
ExecutionContextClient::Trace(visitor);
}
void NativeIOManager::OnBackendDisconnect() {
void NativeIOFileManager::OnBackendDisconnect() {
backend_.reset();
}
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_NATIVE_IO_NATIVE_IO_MANAGER_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_NATIVE_IO_NATIVE_IO_MANAGER_H_
#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_NATIVE_IO_NATIVE_IO_FILE_MANAGER_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_NATIVE_IO_NATIVE_IO_FILE_MANAGER_H_
#include "third_party/blink/public/mojom/native_io/native_io.mojom-blink.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise.h"
......@@ -21,20 +21,21 @@ class ExceptionState;
class NativeIOFileSync;
class ScriptState;
class NativeIOManager final : public ScriptWrappable,
public ExecutionContextClient {
class NativeIOFileManager final : public ScriptWrappable,
public ExecutionContextClient {
DEFINE_WRAPPERTYPEINFO();
public:
explicit NativeIOManager(ExecutionContext*,
HeapMojoRemote<mojom::blink::NativeIOHost> backend);
explicit NativeIOFileManager(
ExecutionContext*,
HeapMojoRemote<mojom::blink::NativeIOHost> backend);
NativeIOManager(const NativeIOManager&) = delete;
NativeIOManager& operator=(const NativeIOManager&) = delete;
NativeIOFileManager(const NativeIOFileManager&) = delete;
NativeIOFileManager& operator=(const NativeIOFileManager&) = delete;
// Needed because of the
// mojo::Remote<blink::mojom::NativeIOHost>
~NativeIOManager() override;
~NativeIOFileManager() override;
ScriptPromise open(ScriptState*, String name, ExceptionState&);
ScriptPromise Delete(ScriptState*, String name, ExceptionState&);
......@@ -65,4 +66,4 @@ class NativeIOManager final : public ScriptWrappable,
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_NATIVE_IO_NATIVE_IO_MANAGER_H_
#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_NATIVE_IO_NATIVE_IO_FILE_MANAGER_H_
// Copyright 2020 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.
// https://github.com/fivedots/nativeio-explainer
[Exposed = (Window, Worker),
RuntimeEnabled = NativeIO,
SecureContext] interface NativeIOFileManager {
[ CallWith = ScriptState, RaisesException ] Promise<NativeIOFile> open(
DOMString name);
[ Exposed = DedicatedWorker, RaisesException ] NativeIOFileSync openSync(
DOMString name);
[ CallWith = ScriptState, ImplementedAs = Delete,
RaisesException ] Promise<void> delete (DOMString name);
[ Exposed = DedicatedWorker, RaisesException ] void deleteSync(
DOMString name);
[ CallWith = ScriptState, RaisesException ] Promise<sequence<DOMString>>
getAll();
[ Exposed = DedicatedWorker, RaisesException ] sequence<DOMString>
getAllSync();
[ CallWith = ScriptState, RaisesException ] Promise<void> rename(
DOMString old_name, DOMString new_name);
[ Exposed = DedicatedWorker, RaisesException ] void renameSync(
DOMString old_name, DOMString new_name);
};
// Copyright 2020 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.
// https://github.com/fivedots/nativeio-explainer
[
Exposed=(Window,Worker),
RuntimeEnabled=NativeIO,
SecureContext
] interface NativeIOManager {
[
CallWith=ScriptState, RaisesException
] Promise<NativeIOFile> open(DOMString name);
[
Exposed=DedicatedWorker, RaisesException
] NativeIOFileSync openSync(DOMString name);
[
CallWith=ScriptState, ImplementedAs=Delete, RaisesException
] Promise<void> delete(DOMString name);
[Exposed=DedicatedWorker, RaisesException] void deleteSync(DOMString name);
[
CallWith=ScriptState, RaisesException
] Promise<sequence<DOMString>> getAll();
[Exposed=DedicatedWorker, RaisesException] sequence<DOMString> getAllSync();
[
CallWith=ScriptState, RaisesException
] Promise<void> rename(DOMString old_name, DOMString new_name);
[Exposed=DedicatedWorker, RaisesException] void renameSync(DOMString old_name, DOMString new_name);
};
......@@ -9,5 +9,5 @@
RuntimeEnabled=NativeIO,
SecureContext
] partial interface Window {
readonly attribute NativeIOManager nativeIO;
readonly attribute NativeIOFileManager nativeIO;
};
......@@ -9,5 +9,5 @@
RuntimeEnabled=NativeIO,
SecureContext
] partial interface WorkerGlobalScope {
readonly attribute NativeIOManager nativeIO;
readonly attribute NativeIOFileManager nativeIO;
};
......@@ -901,7 +901,7 @@ interface NativeIOFile
method read
method setLength
method write
interface NativeIOManager
interface NativeIOFileManager
attribute @@toStringTag
method constructor
method delete
......
......@@ -902,16 +902,7 @@ Starting worker: resources/global-interface-listing-worker.js
[Worker] method read
[Worker] method setLength
[Worker] method write
[Worker] interface NativeIOFileSync
[Worker] attribute @@toStringTag
[Worker] method close
[Worker] method constructor
[Worker] method flush
[Worker] method getLength
[Worker] method read
[Worker] method setLength
[Worker] method write
[Worker] interface NativeIOManager
[Worker] interface NativeIOFileManager
[Worker] attribute @@toStringTag
[Worker] method constructor
[Worker] method delete
......@@ -922,6 +913,15 @@ Starting worker: resources/global-interface-listing-worker.js
[Worker] method openSync
[Worker] method rename
[Worker] method renameSync
[Worker] interface NativeIOFileSync
[Worker] attribute @@toStringTag
[Worker] method close
[Worker] method constructor
[Worker] method flush
[Worker] method getLength
[Worker] method read
[Worker] method setLength
[Worker] method write
[Worker] interface NavigationPreloadManager
[Worker] attribute @@toStringTag
[Worker] method constructor
......
......@@ -5417,7 +5417,7 @@ interface NativeIOFile
method read
method setLength
method write
interface NativeIOManager
interface NativeIOFileManager
attribute @@toStringTag
method constructor
method delete
......
......@@ -827,7 +827,7 @@ Starting worker: resources/global-interface-listing-worker.js
[Worker] method read
[Worker] method setLength
[Worker] method write
[Worker] interface NativeIOManager
[Worker] interface NativeIOFileManager
[Worker] attribute @@toStringTag
[Worker] method constructor
[Worker] method delete
......
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