flutter_flutter/shell/platform_view.h
Adam Barth 11f482978c Stocks app shouldn't show black when resuming from recents list
Previously, we weren't scheduling a visual update when our surface was created,
so we'd just continue to show black until the author requested a new animation
frame. After this CL, we schedule a visual update as soon as our surface is
created.

As part of this change, I've removed knowledge of the GPU delegate from
PlatformView. Now, all the calls from PlatformView to the GPU system bounce
through the UI delegate, which serializes the commands with other commands from
the UI engine to the GPU rasterizer.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/974483004
2015-03-02 16:25:24 -08:00

58 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/ui_delegate.h"
struct ANativeWindow;
namespace sky {
namespace shell {
class PlatformView {
public:
struct Config {
base::WeakPtr<UIDelegate> ui_delegate;
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner;
};
static bool Register(JNIEnv* env);
explicit PlatformView(const Config& config);
~PlatformView();
void ConnectToViewportObserver(
mojo::InterfaceRequest<ViewportObserver> request);
// Called from Java
void Detach(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(PlatformView);
};
} // namespace shell
} // namespace sky
#endif // SKY_SHELL_SKY_VIEW_H_