Kaushik Iska 03318327d2
[flutter_runner] Port Expose ViewBound Wireframe Functionality (#11635)
Expose scenic's ability to toggle wireframe debug
rendering of view bounds in flutter_runner. This is done
by registering a new function on the platform_views channel
with the PlatformView.

Note: Unittests have not been enabled, will enable once we
have sufficient infra.

SCN-1351 #done

Change-Id: Id4c8ef65cc39a967087d7fa6c9f595da8cfe5f01
2019-08-28 12:46:24 -07:00

56 lines
1.8 KiB
C++

// Copyright 2013 The Flutter 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_FUCHSIA_COMPOSITOR_CONTEXT_H_
#define FLUTTER_SHELL_PLATFORM_FUCHSIA_COMPOSITOR_CONTEXT_H_
#include <fuchsia/ui/scenic/cpp/fidl.h>
#include <fuchsia/ui/views/cpp/fidl.h>
#include <lib/fit/function.h>
#include "flutter/flow/compositor_context.h"
#include "flutter/flow/embedded_views.h"
#include "flutter/fml/macros.h"
#include "session_connection.h"
namespace flutter_runner {
// Holds composition specific state and bindings specific to composition on
// Fuchsia.
class CompositorContext final : public flutter::CompositorContext {
public:
CompositorContext(std::string debug_label,
fuchsia::ui::views::ViewToken view_token,
fidl::InterfaceHandle<fuchsia::ui::scenic::Session> session,
fml::closure session_error_callback,
zx_handle_t vsync_event_handle);
~CompositorContext() override;
void OnSessionMetricsDidChange(const fuchsia::ui::gfx::Metrics& metrics);
void OnSessionSizeChangeHint(float width_change_factor,
float height_change_factor);
void OnWireframeEnabled(bool enabled);
private:
const std::string debug_label_;
SessionConnection session_connection_;
// |flutter::CompositorContext|
std::unique_ptr<ScopedFrame> AcquireFrame(
GrContext* gr_context,
SkCanvas* canvas,
flutter::ExternalViewEmbedder* view_embedder,
const SkMatrix& root_surface_transformation,
bool instrumentation_enabled,
fml::RefPtr<fml::GpuThreadMerger> gpu_thread_merger) override;
FML_DISALLOW_COPY_AND_ASSIGN(CompositorContext);
};
} // namespace flutter_runner
#endif // FLUTTER_SHELL_PLATFORM_FUCHSIA_COMPOSITOR_CONTEXT_H_