xster f187a5c219 Create platform API for first frame callback. Use for defer hiding splash screens on Android and iOS (#3956)
* Add back launch screen view until first frame on iOS

* improvements

* Move callback plumbing from ios surfaces to the gpu rasterizer. Didn’t wire java JNI yet.

* Android JNI

* Fix ios reference count and let android engine manage a view on top with launch screen

* Hook up Android activity and view

* review notes

* review notes

* Move thread switching upstream. Use weak references for callbacks.

* Some clean up
2017-08-14 15:44:52 -07:00

46 lines
1.3 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 SHELL_COMMON_RASTERIZER_H_
#define SHELL_COMMON_RASTERIZER_H_
#include <memory>
#include "flutter/flow/layers/layer_tree.h"
#include "flutter/shell/common/surface.h"
#include "flutter/synchronization/pipeline.h"
#include "lib/ftl/functional/closure.h"
#include "lib/ftl/memory/weak_ptr.h"
#include "lib/ftl/synchronization/waitable_event.h"
namespace shell {
class Rasterizer {
public:
virtual ~Rasterizer();
virtual void Setup(std::unique_ptr<Surface> surface_or_null,
ftl::Closure rasterizer_continuation,
ftl::AutoResetWaitableEvent* setup_completion_event) = 0;
virtual void Teardown(
ftl::AutoResetWaitableEvent* teardown_completion_event) = 0;
virtual void Clear(SkColor color, const SkISize& size) = 0;
virtual ftl::WeakPtr<Rasterizer> GetWeakRasterizerPtr() = 0;
virtual flow::LayerTree* GetLastLayerTree() = 0;
virtual void Draw(
ftl::RefPtr<flutter::Pipeline<flow::LayerTree>> pipeline) = 0;
// Set a callback to be called once when the next frame is drawn.
virtual void AddNextFrameCallback(ftl::Closure nextFrameCallback) = 0;
};
} // namespace shell
#endif // SHELL_COMMON_RASTERIZER_H_