OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/android/compositor/scene_layer/scene_layer.h" | 5 #include "chrome/browser/android/compositor/scene_layer/scene_layer.h" |
6 | 6 |
7 #include "cc/layers/layer.h" | 7 #include "cc/layers/layer.h" |
8 #include "cc/layers/layer_settings.h" | |
9 #include "content/public/browser/android/compositor.h" | 8 #include "content/public/browser/android/compositor.h" |
10 #include "jni/SceneLayer_jni.h" | 9 #include "jni/SceneLayer_jni.h" |
11 | 10 |
12 namespace chrome { | 11 namespace chrome { |
13 namespace android { | 12 namespace android { |
14 | 13 |
15 // static | 14 // static |
16 SceneLayer* SceneLayer::FromJavaObject(JNIEnv* env, jobject jobj) { | 15 SceneLayer* SceneLayer::FromJavaObject(JNIEnv* env, jobject jobj) { |
17 if (jobj == nullptr) | 16 if (jobj == nullptr) |
18 return nullptr; | 17 return nullptr; |
19 return reinterpret_cast<SceneLayer*>(Java_SceneLayer_getNativePtr(env, jobj)); | 18 return reinterpret_cast<SceneLayer*>(Java_SceneLayer_getNativePtr(env, jobj)); |
20 } | 19 } |
21 | 20 |
22 SceneLayer::SceneLayer(JNIEnv* env, jobject jobj) | 21 SceneLayer::SceneLayer(JNIEnv* env, jobject jobj) |
23 : SceneLayer(env, | 22 : SceneLayer(env, jobj, cc::Layer::Create()) {} |
24 jobj, | |
25 cc::Layer::Create(cc::LayerSettings())) { | |
26 } | |
27 | 23 |
28 SceneLayer::SceneLayer(JNIEnv* env, | 24 SceneLayer::SceneLayer(JNIEnv* env, |
29 jobject jobj, | 25 jobject jobj, |
30 scoped_refptr<cc::Layer> layer) | 26 scoped_refptr<cc::Layer> layer) |
31 : weak_java_scene_layer_(env, jobj), layer_(layer) { | 27 : weak_java_scene_layer_(env, jobj), layer_(layer) { |
32 Java_SceneLayer_setNativePtr(env, jobj, reinterpret_cast<intptr_t>(this)); | 28 Java_SceneLayer_setNativePtr(env, jobj, reinterpret_cast<intptr_t>(this)); |
33 } | 29 } |
34 | 30 |
35 SceneLayer::~SceneLayer() { | 31 SceneLayer::~SceneLayer() { |
36 JNIEnv* env = base::android::AttachCurrentThread(); | 32 JNIEnv* env = base::android::AttachCurrentThread(); |
(...skipping 27 matching lines...) Expand all Loading... |
64 SceneLayer* tree_provider = new SceneLayer(env, jobj); | 60 SceneLayer* tree_provider = new SceneLayer(env, jobj); |
65 return reinterpret_cast<intptr_t>(tree_provider); | 61 return reinterpret_cast<intptr_t>(tree_provider); |
66 } | 62 } |
67 | 63 |
68 bool RegisterSceneLayer(JNIEnv* env) { | 64 bool RegisterSceneLayer(JNIEnv* env) { |
69 return RegisterNativesImpl(env); | 65 return RegisterNativesImpl(env); |
70 } | 66 } |
71 | 67 |
72 } // namespace android | 68 } // namespace android |
73 } // namespace chrome | 69 } // namespace chrome |
OLD | NEW |