Flutter Engine
native_library.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_FML_NATIVE_LIBRARY_H_
6 #define FLUTTER_FML_NATIVE_LIBRARY_H_
7 
8 #include "flutter/fml/build_config.h"
9 #include "flutter/fml/macros.h"
10 #include "flutter/fml/memory/ref_counted.h"
11 #include "flutter/fml/memory/ref_ptr.h"
12 
13 #if defined(OS_WIN)
14 #include <windows.h>
15 #endif // defined(OS_WIN)
16 
17 namespace fml {
18 class NativeLibrary : public fml::RefCountedThreadSafe<NativeLibrary> {
19  public:
20 #if OS_WIN
21  using Handle = HMODULE;
22 #else // OS_WIN
23  using Handle = void*;
24 #endif // OS_WIN
25 
26  static fml::RefPtr<NativeLibrary> Create(const char* path);
27 
29  Handle handle,
30  bool close_handle_when_done);
31 
33 
34  const uint8_t* ResolveSymbol(const char* symbol);
35 
36  private:
37  Handle handle_ = nullptr;
38  bool close_handle_ = true;
39 
40  NativeLibrary(const char* path);
41 
42  NativeLibrary(Handle handle, bool close_handle);
43 
44  ~NativeLibrary();
45 
46  Handle GetHandle() const;
47 
48  FML_DISALLOW_COPY_AND_ASSIGN(NativeLibrary);
49  FML_FRIEND_REF_COUNTED_THREAD_SAFE(NativeLibrary);
50  FML_FRIEND_MAKE_REF_COUNTED(NativeLibrary);
51 };
52 
53 } // namespace fml
54 
55 #endif // FLUTTER_FML_NATIVE_LIBRARY_H_
DEF_SWITCHES_START snapshot asset path
Definition: switches.h:32
static fml::RefPtr< NativeLibrary > CreateForCurrentProcess()
static fml::RefPtr< NativeLibrary > CreateWithHandle(Handle handle, bool close_handle_when_done)
Definition: ascii_trie.cc:9
static fml::RefPtr< NativeLibrary > Create(const char *path)
const uint8_t * ResolveSymbol(const char *symbol)