flutter_flutter/shell/sky_view.h
Adam Barth f3c8503dfc Plumb resize notifications around sky/shell
This CL plumbs resize notifications from SkyView to Engine. I've taken the
opportunity to reorganize how notifications generated by SkyView are plumbed to
the GPU and UI threads. This approach should reduce the amount of plumbing
needed for new notifications.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/880443003
2015-02-05 20:08:22 -08:00

59 lines
1.4 KiB
C++

// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_SHELL_SKY_VIEW_H_
#define SKY_SHELL_SKY_VIEW_H_
#include "base/android/jni_weak_ref.h"
#include "base/android/scoped_java_ref.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/single_thread_task_runner.h"
#include "sky/shell/gpu_delegate.h"
#include "sky/shell/ui_delegate.h"
struct ANativeWindow;
namespace sky {
namespace shell {
class SkyView {
public:
struct Config {
base::WeakPtr<GPUDelegate> gpu_delegate;
scoped_refptr<base::SingleThreadTaskRunner> gpu_task_runner;
base::WeakPtr<UIDelegate> ui_delegate;
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner;
};
static bool Register(JNIEnv* env);
explicit SkyView(const Config& config);
~SkyView();
// Called from Java
void Destroy(JNIEnv* env, jobject obj);
void SurfaceCreated(JNIEnv* env, jobject obj, jobject jsurface);
void SurfaceDestroyed(JNIEnv* env, jobject obj);
void SurfaceSetSize(JNIEnv* env,
jobject obj,
jint width,
jint height,
jfloat density);
private:
void ReleaseWindow();
Config config_;
ANativeWindow* window_;
DISALLOW_COPY_AND_ASSIGN(SkyView);
};
} // namespace shell
} // namespace sky
#endif // SKY_SHELL_SKY_VIEW_H_