Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(600)

Unified Diff: sky/shell/platform_view.cc

Issue 936883002: Connect Sky and Ganesh in SkyShell (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: sort includes Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sky/shell/platform_view.cc
diff --git a/sky/shell/sky_view.cc b/sky/shell/platform_view.cc
similarity index 71%
rename from sky/shell/sky_view.cc
rename to sky/shell/platform_view.cc
index d7b22112192344c5b5ccc79c5091b42069f49313..6fe2c1f28209750a4ab75cac36544e0c2f4f5507 100644
--- a/sky/shell/sky_view.cc
+++ b/sky/shell/platform_view.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "sky/shell/sky_view.h"
+#include "sky/shell/platform_view.h"
#include <android/input.h>
#include <android/native_window_jni.h>
@@ -10,31 +10,35 @@
#include "base/android/jni_android.h"
#include "base/bind.h"
#include "base/location.h"
-#include "jni/SkyView_jni.h"
+#include "jni/PlatformView_jni.h"
+#include "sky/shell/shell.h"
namespace sky {
namespace shell {
+static jlong Attach(JNIEnv* env, jclass clazz) {
+ return reinterpret_cast<jlong>(Shell::Current().view());
+}
+
// static
-bool SkyView::Register(JNIEnv* env) {
+bool PlatformView::Register(JNIEnv* env) {
return RegisterNativesImpl(env);
}
-SkyView::SkyView(const Config& config) : config_(config), window_(nullptr) {
- JNIEnv* env = base::android::AttachCurrentThread();
- Java_SkyView_createForActivity(env, base::android::GetApplicationContext(),
- reinterpret_cast<jlong>(this));
+PlatformView::PlatformView(const Config& config)
+ : config_(config), window_(nullptr) {
}
-SkyView::~SkyView() {
+PlatformView::~PlatformView() {
if (window_)
ReleaseWindow();
}
-void SkyView::Destroy(JNIEnv* env, jobject obj) {
+void PlatformView::Detach(JNIEnv* env, jobject obj) {
+ DCHECK(!window_);
}
-void SkyView::SurfaceCreated(JNIEnv* env, jobject obj, jobject jsurface) {
+void PlatformView::SurfaceCreated(JNIEnv* env, jobject obj, jobject jsurface) {
base::android::ScopedJavaLocalRef<jobject> protector(env, jsurface);
// Note: This ensures that any local references used by
// ANativeWindow_fromSurface are released immediately. This is needed as a
@@ -48,7 +52,7 @@ void SkyView::SurfaceCreated(JNIEnv* env, jobject obj, jobject jsurface) {
config_.gpu_delegate, window_));
}
-void SkyView::SurfaceDestroyed(JNIEnv* env, jobject obj) {
+void PlatformView::SurfaceDestroyed(JNIEnv* env, jobject obj) {
DCHECK(window_);
config_.gpu_task_runner->PostTask(
FROM_HERE,
@@ -56,7 +60,7 @@ void SkyView::SurfaceDestroyed(JNIEnv* env, jobject obj) {
ReleaseWindow();
}
-void SkyView::SurfaceSetSize(JNIEnv* env,
+void PlatformView::SurfaceSetSize(JNIEnv* env,
jobject obj,
jint width,
jint height,
@@ -67,7 +71,7 @@ void SkyView::SurfaceSetSize(JNIEnv* env,
gfx::Size(width, height), density));
}
-void SkyView::ReleaseWindow() {
+void PlatformView::ReleaseWindow() {
ANativeWindow_release(window_);
window_ = nullptr;
}
« no previous file with comments | « sky/shell/platform_view.h ('k') | sky/shell/shell.h » ('j') | sky/shell/shell.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698