Flutter Engine
The Flutter Engine
native_assets.h
Go to the documentation of this file.
1// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
2// for details. All rights reserved. Use of this source code is governed by a
3// BSD-style license that can be found in the LICENSE file.
4
5#ifndef RUNTIME_VM_FFI_NATIVE_ASSETS_H_
6#define RUNTIME_VM_FFI_NATIVE_ASSETS_H_
7
8#include "vm/hash_table.h"
9#include "vm/tagged_pointer.h"
10#include "vm/thread.h"
11
12namespace dart {
13
15 public:
16 static const char* Name() { return "NativeAssetsMapTraits"; }
17 static bool ReportStats() { return false; }
18
19 static bool IsMatch(const Object& a, const Object& b) {
20 const String& a_str = String::Cast(a);
21 const String& b_str = String::Cast(b);
22
23 ASSERT(a_str.HasHash() && b_str.HasHash());
24 return a_str.Equals(b_str);
25 }
26
27 static uword Hash(const Object& key) { return String::Cast(key).Hash(); }
28
29 static ObjectPtr NewKey(const String& str) { return str.ptr(); }
30};
32
33// In JIT: Populates object_store->native_assets_map with the right info from
34// object_store->native_assets_library.
35//
36// In AOT: The object_store->native_assets_library should have been
37// pre-populated from the aotsnapshot.
38ArrayPtr GetNativeAssetsMap(Thread* thread);
39
40} // namespace dart
41
42#endif // RUNTIME_VM_FFI_NATIVE_ASSETS_H_
static const char * Name()
Definition: native_assets.h:16
static ObjectPtr NewKey(const String &str)
Definition: native_assets.h:29
static bool IsMatch(const Object &a, const Object &b)
Definition: native_assets.h:19
static uword Hash(const Object &key)
Definition: native_assets.h:27
ObjectPtr ptr() const
Definition: object.h:332
bool HasHash() const
Definition: object.h:10229
bool Equals(const String &str) const
Definition: object.h:13337
#define ASSERT(E)
static bool b
struct MyStruct a[10]
Definition: dart_vm.cc:33
uintptr_t uword
Definition: globals.h:501
ArrayPtr GetNativeAssetsMap(Thread *thread)
UnorderedHashMap< NativeAssetsMapTraits > NativeAssetsMap
Definition: native_assets.h:31