diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-07-16 11:45:35 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-07-17 08:59:23 +0000 |
commit | 552906b0f222c5d5dd11b9fd73829d510980461a (patch) | |
tree | 3a11e6ed0538a81dd83b20cf3a4783e297f26d91 /chromium/third_party/blink/renderer/modules/native_io/native_io_file_sync.h | |
parent | 1b05827804eaf047779b597718c03e7d38344261 (diff) | |
download | qtwebengine-chromium-552906b0f222c5d5dd11b9fd73829d510980461a.tar.gz |
BASELINE: Update Chromium to 83.0.4103.122
Change-Id: Ie3a82f5bb0076eec2a7c6a6162326b4301ee291e
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/modules/native_io/native_io_file_sync.h')
-rw-r--r-- | chromium/third_party/blink/renderer/modules/native_io/native_io_file_sync.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/chromium/third_party/blink/renderer/modules/native_io/native_io_file_sync.h b/chromium/third_party/blink/renderer/modules/native_io/native_io_file_sync.h new file mode 100644 index 00000000000..d36815e6c93 --- /dev/null +++ b/chromium/third_party/blink/renderer/modules/native_io/native_io_file_sync.h @@ -0,0 +1,69 @@ +// 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. + +#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_NATIVE_IO_NATIVE_IO_FILE_SYNC_H_ +#define THIRD_PARTY_BLINK_RENDERER_MODULES_NATIVE_IO_NATIVE_IO_FILE_SYNC_H_ + +#include <stdint.h> + +#include "base/files/file.h" +#include "mojo/public/cpp/bindings/remote.h" +#include "third_party/blink/public/mojom/native_io/native_io.mojom-blink.h" +#include "third_party/blink/renderer/core/execution_context/execution_context_lifecycle_observer.h" +#include "third_party/blink/renderer/core/typed_arrays/array_buffer_view_helpers.h" +#include "third_party/blink/renderer/core/typed_arrays/dom_array_buffer_view.h" +#include "third_party/blink/renderer/platform/bindings/script_wrappable.h" +#include "third_party/blink/renderer/platform/heap/handle.h" +#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" +#include "third_party/blink/renderer/platform/wtf/vector.h" + +namespace blink { + +class ExceptionState; +class ExecutionContext; + +class NativeIOFileSync final : public ScriptWrappable, + public ExecutionContextLifecycleObserver { + DEFINE_WRAPPERTYPEINFO(); + USING_GARBAGE_COLLECTED_MIXIN(NativeIOFileSync); + + public: + NativeIOFileSync(base::File backing_file, + mojo::Remote<mojom::blink::NativeIOFileHost> backend_file, + ExecutionContext*); + + NativeIOFileSync(const NativeIOFileSync&) = delete; + NativeIOFileSync& operator=(const NativeIOFileSync&) = delete; + + // Needed because of the mojo::Remote<mojom::blink::NativeIOFile>. + ~NativeIOFileSync() override; + + void close(); + int read(MaybeShared<DOMArrayBufferView> buffer, + uint64_t file_offset, + ExceptionState&); + int write(MaybeShared<DOMArrayBufferView> buffer, + uint64_t file_offset, + ExceptionState&); + + // GarbageCollected + void Trace(Visitor* visitor) override; + + // ExecutionContextLifecycleObserver + void ContextDestroyed() override; + + private: + // Called when the mojo backend disconnects. + void OnBackendDisconnect(); + + // The file on disk backing this NativeIOFile. + base::File backing_file_; + + // Mojo pipe that holds the renderer's lock on the file. + mojo::Remote<mojom::blink::NativeIOFileHost> backend_file_; +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_NATIVE_IO_NATIVE_IO_FILE_SYNC_H_ |