OLD | NEW |
| (Empty) |
1 // Copyright 2016 The Chromium 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 BLIMP_CLIENT_APP_ANDROID_BLIMP_ENVIRONMENT_H_ | |
6 #define BLIMP_CLIENT_APP_ANDROID_BLIMP_ENVIRONMENT_H_ | |
7 | |
8 #include "base/android/jni_android.h" | |
9 #include "base/android/scoped_java_ref.h" | |
10 #include "base/macros.h" | |
11 | |
12 class PrefService; | |
13 | |
14 namespace base { | |
15 class Thread; | |
16 } // namespace base | |
17 | |
18 namespace blimp { | |
19 namespace client { | |
20 class BlimpClientContext; | |
21 class BlimpClientContextDelegate; | |
22 class CompositorDependencies; | |
23 class CompositorDependenciesImpl; | |
24 | |
25 // BlimpEnvironment is the core environment required to run Blimp for Android. | |
26 class BlimpEnvironment { | |
27 public: | |
28 BlimpEnvironment(); | |
29 ~BlimpEnvironment(); | |
30 static bool RegisterJni(JNIEnv* env); | |
31 | |
32 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& jobj); | |
33 | |
34 static BlimpEnvironment* FromJavaObject( | |
35 JNIEnv* env, | |
36 const base::android::JavaRef<jobject>& jobj); | |
37 | |
38 base::android::ScopedJavaLocalRef<jobject> GetBlimpClientContext( | |
39 JNIEnv* env, | |
40 const base::android::JavaParamRef<jobject>& jobj); | |
41 | |
42 std::unique_ptr<CompositorDependencies> CreateCompositorDepencencies(); | |
43 | |
44 private: | |
45 friend class DelegatingCompositorDependencies; | |
46 | |
47 void DecrementOutstandingCompositorDependencies(); | |
48 | |
49 // The CompositorDependencies used as the delegate for all minted | |
50 // CompositorDependencies. | |
51 std::unique_ptr<CompositorDependenciesImpl> compositor_dependencies_; | |
52 | |
53 // The number of outstanding CompositorDependencies. The minted | |
54 // DelegatingCompositorDependencies will decrement this value during their | |
55 // destruction. | |
56 int outstanding_compositor_dependencies_ = 0; | |
57 | |
58 std::unique_ptr<base::Thread> io_thread_; | |
59 | |
60 std::unique_ptr<PrefService> pref_service_; | |
61 | |
62 std::unique_ptr<BlimpClientContextDelegate> context_delegate_; | |
63 | |
64 std::unique_ptr<BlimpClientContext> context_; | |
65 | |
66 DISALLOW_COPY_AND_ASSIGN(BlimpEnvironment); | |
67 }; | |
68 | |
69 } // namespace client | |
70 } // namespace blimp | |
71 | |
72 #endif // BLIMP_CLIENT_APP_ANDROID_BLIMP_ENVIRONMENT_H_ | |
OLD | NEW |