Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
host_buffer.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_LIB_GPU_HOST_BUFFER_H_
6#define FLUTTER_LIB_GPU_HOST_BUFFER_H_
7
8#include "flutter/lib/gpu/export.h"
9#include "flutter/lib/ui/dart_wrapper.h"
12#include "lib/gpu/context.h"
14
15namespace flutter {
16namespace gpu {
17
18class HostBuffer : public RefCountedDartWrappable<HostBuffer> {
19 DEFINE_WRAPPERTYPEINFO();
21
22 public:
23 explicit HostBuffer(Context* context);
24
25 ~HostBuffer() override;
26
27 std::shared_ptr<impeller::HostBuffer> GetBuffer();
28
29 size_t EmplaceBytes(const tonic::DartByteData& byte_data);
30
31 std::optional<impeller::BufferView> GetBufferViewForOffset(size_t offset);
32
33 private:
34 size_t current_offset_ = 0;
35 std::shared_ptr<impeller::HostBuffer> host_buffer_;
36 std::unordered_map<size_t, impeller::BufferView> emplacements_;
37
39};
40
41} // namespace gpu
42} // namespace flutter
43
44//----------------------------------------------------------------------------
45/// Exports
46///
47
48extern "C" {
49
52 Dart_Handle wrapper,
53 flutter::gpu::Context* context);
54
58 Dart_Handle byte_data);
59
60} // extern "C"
61
62#endif // FLUTTER_LIB_GPU_HOST_BUFFER_H_
std::shared_ptr< impeller::HostBuffer > GetBuffer()
size_t EmplaceBytes(const tonic::DartByteData &byte_data)
std::optional< impeller::BufferView > GetBufferViewForOffset(size_t offset)
struct _Dart_Handle * Dart_Handle
Definition dart_api.h:258
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition macros.h:27
#define FLUTTER_GPU_EXPORT
Definition export.h:13
FLUTTER_GPU_EXPORT void InternalFlutterGpu_HostBuffer_Initialize(Dart_Handle wrapper, flutter::gpu::Context *context)
FLUTTER_GPU_EXPORT size_t InternalFlutterGpu_HostBuffer_EmplaceBytes(flutter::gpu::HostBuffer *wrapper, Dart_Handle byte_data)
#define FML_FRIEND_MAKE_REF_COUNTED(T)
Point offset