Flutter Engine
android_native_window.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_SHELL_PLATFORM_ANDROID_ANDROID_NATIVE_WINDOW_H_
6 #define FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_NATIVE_WINDOW_H_
7 
8 #include "flutter/fml/build_config.h"
9 
10 #include "flutter/fml/macros.h"
11 #include "flutter/fml/memory/ref_counted.h"
12 #include "third_party/skia/include/core/SkSize.h"
13 
14 #if OS_ANDROID
15 #include <android/native_window.h>
16 #endif // OS_ANDROID
17 
18 namespace flutter {
19 
21  : public fml::RefCountedThreadSafe<AndroidNativeWindow> {
22  public:
23 #if OS_ANDROID
24  using Handle = ANativeWindow*;
25 #else // OS_ANDROID
26  using Handle = std::nullptr_t;
27 #endif // OS_ANDROID
28 
29  bool IsValid() const;
30 
31  Handle handle() const;
32 
33  SkISize GetSize() const;
34 
35  private:
36  Handle window_;
37 
38  /// Creates a native window with the given handle. Handle ownership is assumed
39  /// by this instance of the native window.
40  explicit AndroidNativeWindow(Handle window);
41 
43 
44  FML_FRIEND_MAKE_REF_COUNTED(AndroidNativeWindow);
45  FML_FRIEND_REF_COUNTED_THREAD_SAFE(AndroidNativeWindow);
46  FML_DISALLOW_COPY_AND_ASSIGN(AndroidNativeWindow);
47 };
48 
49 } // namespace flutter
50 
51 #endif // FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_NATIVE_WINDOW_H_
struct ANativeWindow ANativeWindow