mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
* Re-land "Support multiple shells in a single process. (#4932)" This reverts commit 723c7d01439da4261bc836075fb55651ce9e7f03.
67 lines
2.2 KiB
C++
67 lines
2.2 KiB
C++
// Copyright 2017 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 FLUTTER_SHELL_PLATFORM_EMBEDDER_PLATFORM_VIEW_EMBEDDER_H_
|
|
#define FLUTTER_SHELL_PLATFORM_EMBEDDER_PLATFORM_VIEW_EMBEDDER_H_
|
|
|
|
#include "flutter/shell/common/platform_view.h"
|
|
#include "flutter/shell/gpu/gpu_surface_gl.h"
|
|
#include "flutter/shell/platform/embedder/embedder.h"
|
|
#include "lib/fxl/macros.h"
|
|
|
|
namespace shell {
|
|
|
|
class PlatformViewEmbedder final : public PlatformView,
|
|
public GPUSurfaceGLDelegate {
|
|
public:
|
|
using PlatformMessageResponseCallback =
|
|
std::function<void(fxl::RefPtr<blink::PlatformMessage>)>;
|
|
struct DispatchTable {
|
|
std::function<bool(void)> gl_make_current_callback; // required
|
|
std::function<bool(void)> gl_clear_current_callback; // required
|
|
std::function<bool(void)> gl_present_callback; // required
|
|
std::function<intptr_t(void)> gl_fbo_callback; // required
|
|
PlatformMessageResponseCallback
|
|
platform_message_response_callback; // optional
|
|
std::function<bool(void)> gl_make_resource_current_callback; // optional
|
|
};
|
|
|
|
PlatformViewEmbedder(PlatformView::Delegate& delegate,
|
|
blink::TaskRunners task_runners,
|
|
DispatchTable dispatch_table);
|
|
|
|
~PlatformViewEmbedder() override;
|
|
|
|
// |shell::GPUSurfaceGLDelegate|
|
|
bool GLContextMakeCurrent() override;
|
|
|
|
// |shell::GPUSurfaceGLDelegate|
|
|
bool GLContextClearCurrent() override;
|
|
|
|
// |shell::GPUSurfaceGLDelegate|
|
|
bool GLContextPresent() override;
|
|
|
|
// |shell::GPUSurfaceGLDelegate|
|
|
intptr_t GLContextFBO() const override;
|
|
|
|
// |shell::PlatformView|
|
|
void HandlePlatformMessage(
|
|
fxl::RefPtr<blink::PlatformMessage> message) override;
|
|
|
|
private:
|
|
DispatchTable dispatch_table_;
|
|
|
|
// |shell::PlatformView|
|
|
std::unique_ptr<Surface> CreateRenderingSurface() override;
|
|
|
|
// |shell::PlatformView|
|
|
sk_sp<GrContext> CreateResourceContext() const override;
|
|
|
|
FXL_DISALLOW_COPY_AND_ASSIGN(PlatformViewEmbedder);
|
|
};
|
|
|
|
} // namespace shell
|
|
|
|
#endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_PLATFORM_VIEW_EMBEDDER_H_
|