Skip to content

Commit

Permalink
Rename Mozart SceneManager to "Scenic". (flutter#4056)
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Gargus authored Sep 2, 2017
1 parent d60d630 commit 321e68e
Show file tree
Hide file tree
Showing 24 changed files with 98 additions and 101 deletions.
2 changes: 1 addition & 1 deletion content_handler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ template("flutter_content_handler") {
"//application/lib/svc",
"//apps/icu_data/lib",
"//apps/mozart/lib/flutter/sdk_ext",
"//apps/mozart/lib/scene:client",
"//apps/mozart/lib/scenic:client",
"//apps/mozart/services/input",
"//apps/mozart/services/views",
"//apps/tracing/lib/trace:provider",
Expand Down
4 changes: 2 additions & 2 deletions content_handler/rasterizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <memory>

#include "apps/mozart/services/scene/session.fidl.h"
#include "apps/mozart/services/scenic/session.fidl.h"
#include "flutter/flow/layers/layer_tree.h"
#include "lib/ftl/functional/closure.h"
#include "lib/ftl/macros.h"
Expand All @@ -22,7 +22,7 @@ class Rasterizer {
static std::unique_ptr<Rasterizer> Create();

virtual void SetScene(
fidl::InterfaceHandle<mozart2::SceneManager> scene_manager,
fidl::InterfaceHandle<scenic::SceneManager> scene_manager,
mx::eventpair import_token,
ftl::Closure metrics_changed_callback) = 0;

Expand Down
2 changes: 1 addition & 1 deletion content_handler/runtime_holder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ void RuntimeHolder::CreateView(
input_connection_->SetEventListener(std::move(input_listener));

// Setup the session.
fidl::InterfaceHandle<mozart2::SceneManager> scene_manager;
fidl::InterfaceHandle<scenic::SceneManager> scene_manager;
view_manager_->GetSceneManager(scene_manager.NewRequest());

blink::Threads::Gpu()->PostTask(ftl::MakeCopyable([
Expand Down
22 changes: 10 additions & 12 deletions content_handler/session_connection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
// found in the LICENSE file.

#include "flutter/content_handler/session_connection.h"
#include "apps/mozart/lib/scene/session_helpers.h"
#include "apps/mozart/lib/scenic/fidl_helpers.h"

namespace flutter_runner {

SessionConnection::SessionConnection(mozart2::SceneManagerPtr scene_manager,
SessionConnection::SessionConnection(scenic::SceneManagerPtr scene_manager,
mx::eventpair import_token)
: session_(scene_manager.get()),
root_node_(&session_),
Expand All @@ -18,12 +18,11 @@ SessionConnection::SessionConnection(mozart2::SceneManagerPtr scene_manager,
session_.set_connection_error_handler(
std::bind(&SessionConnection::OnSessionError, this));
session_.set_event_handler(std::bind(&SessionConnection::OnSessionEvents,
this, std::placeholders::_1,
std::placeholders::_2));
this, std::placeholders::_1));

root_node_.Bind(std::move(import_token));
root_node_.SetEventMask(mozart2::kMetricsEventMask);
session_.Present(0, [](mozart2::PresentationInfoPtr info) {});
root_node_.SetEventMask(scenic::kMetricsEventMask);
session_.Present(0, [](scenic::PresentationInfoPtr info) {});

present_callback_ =
std::bind(&SessionConnection::OnPresent, this, std::placeholders::_1);
Expand All @@ -39,9 +38,8 @@ void SessionConnection::OnSessionError() {
FTL_CHECK(false) << "Session connection was terminated.";
}

void SessionConnection::OnSessionEvents(uint64_t presentation_time,
fidl::Array<mozart2::EventPtr> events) {
mozart2::MetricsPtr new_metrics;
void SessionConnection::OnSessionEvents(fidl::Array<scenic::EventPtr> events) {
scenic::MetricsPtr new_metrics;
for (const auto& event : events) {
if (event->is_metrics() &&
event->get_metrics()->node_id == root_node_.id()) {
Expand Down Expand Up @@ -69,7 +67,7 @@ void SessionConnection::Present(flow::CompositorContext::ScopedFrame& frame,
// tasks.
session_.Present(0, // presentation_time. Placeholder for now.
present_callback_ // callback
);
);

// Execute paint tasks and signal fences.
auto surfaces_to_submit = scene_update_context_.ExecutePaintTasks(frame);
Expand All @@ -82,7 +80,7 @@ void SessionConnection::Present(flow::CompositorContext::ScopedFrame& frame,
EnqueueClearOps();
}

void SessionConnection::OnPresent(mozart2::PresentationInfoPtr info) {
void SessionConnection::OnPresent(scenic::PresentationInfoPtr info) {
ASSERT_IS_GPU_THREAD;
auto callback = pending_on_present_callback_;
pending_on_present_callback_ = nullptr;
Expand All @@ -93,7 +91,7 @@ void SessionConnection::EnqueueClearOps() {
ASSERT_IS_GPU_THREAD;
// We are going to be sending down a fresh node hierarchy every frame. So just
// enqueue a detach op on the imported root node.
session_.Enqueue(mozart::NewDetachChildrenOp(root_node_.id()));
session_.Enqueue(scenic_lib::NewDetachChildrenOp(root_node_.id()));
}

} // namespace flutter_runner
19 changes: 9 additions & 10 deletions content_handler/session_connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#ifndef FLUTTER_CONTENT_HANDLER_SESSION_CONNECTION_H_
#define FLUTTER_CONTENT_HANDLER_SESSION_CONNECTION_H_

#include "apps/mozart/lib/scene/client/resources.h"
#include "apps/mozart/lib/scene/client/session.h"
#include "apps/mozart/lib/scenic/client/resources.h"
#include "apps/mozart/lib/scenic/client/session.h"
#include "flutter/common/threads.h"
#include "flutter/content_handler/vulkan_surface_producer.h"
#include "flutter/flow/compositor_context.h"
Expand All @@ -20,7 +20,7 @@ namespace flutter_runner {

class SessionConnection {
public:
SessionConnection(mozart2::SceneManagerPtr scene_manager,
SessionConnection(scenic::SceneManagerPtr scene_manager,
mx::eventpair import_token);

~SessionConnection();
Expand All @@ -35,7 +35,7 @@ class SessionConnection {
return scene_update_context_;
}

mozart::client::ImportNode& root_node() {
scenic_lib::ImportNode& root_node() {
ASSERT_IS_GPU_THREAD;
return root_node_;
}
Expand All @@ -44,21 +44,20 @@ class SessionConnection {
ftl::Closure on_present_callback);

private:
mozart::client::Session session_;
mozart::client::ImportNode root_node_;
mozart::client::Session::PresentCallback present_callback_;
scenic_lib::Session session_;
scenic_lib::ImportNode root_node_;
scenic_lib::Session::PresentCallback present_callback_;
ftl::Closure pending_on_present_callback_;
std::unique_ptr<VulkanSurfaceProducer> surface_producer_;
flow::SceneUpdateContext scene_update_context_;
ftl::Closure metrics_changed_callback_;

void OnSessionError();
void OnSessionEvents(uint64_t presentation_time,
fidl::Array<mozart2::EventPtr> events);
void OnSessionEvents(fidl::Array<scenic::EventPtr> events);

void EnqueueClearOps();

void OnPresent(mozart2::PresentationInfoPtr info);
void OnPresent(scenic::PresentationInfoPtr info);

FTL_DISALLOW_COPY_AND_ASSIGN(SessionConnection);
};
Expand Down
4 changes: 2 additions & 2 deletions content_handler/vulkan_rasterizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ bool VulkanRasterizer::IsValid() const {
}

void VulkanRasterizer::SetScene(
fidl::InterfaceHandle<mozart2::SceneManager> scene_manager,
fidl::InterfaceHandle<scenic::SceneManager> scene_manager,
mx::eventpair import_token,
ftl::Closure metrics_changed_callback) {
ASSERT_IS_GPU_THREAD;
FTL_DCHECK(valid_ && !session_connection_);
session_connection_ = std::make_unique<SessionConnection>(
mozart2::SceneManagerPtr::Create(std::move(scene_manager)),
scenic::SceneManagerPtr::Create(std::move(scene_manager)),
std::move(import_token));
session_connection_->set_metrics_changed_callback(
std::move(metrics_changed_callback));
Expand Down
2 changes: 1 addition & 1 deletion content_handler/vulkan_rasterizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class VulkanRasterizer : public Rasterizer {

bool IsValid() const;

void SetScene(fidl::InterfaceHandle<mozart2::SceneManager> scene_manager,
void SetScene(fidl::InterfaceHandle<scenic::SceneManager> scene_manager,
mx::eventpair import_token,
ftl::Closure metrics_changed_callback) override;

Expand Down
20 changes: 10 additions & 10 deletions content_handler/vulkan_surface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace flutter_runner {
VulkanSurface::VulkanSurface(vulkan::VulkanProcTable& p_vk,
sk_sp<GrContext> context,
sk_sp<GrVkBackendContext> backend_context,
mozart::client::Session* session,
scenic_lib::Session* session,
const SkISize& size)
: vk_(p_vk),
backend_context_(std::move(backend_context)),
Expand Down Expand Up @@ -226,30 +226,30 @@ bool VulkanSurface::SetupSkiaSurface(sk_sp<GrContext> context,
return true;
}

bool VulkanSurface::PushSessionImageSetupOps(mozart::client::Session* session,
bool VulkanSurface::PushSessionImageSetupOps(scenic_lib::Session* session,
mx::vmo exported_vmo) {
if (sk_surface_ == nullptr) {
return false;
}

mozart::client::Memory memory(session, std::move(exported_vmo),
mozart2::MemoryType::VK_DEVICE_MEMORY);
scenic_lib::Memory memory(session, std::move(exported_vmo),
scenic::MemoryType::VK_DEVICE_MEMORY);

auto image_info = mozart2::ImageInfo::New();
auto image_info = scenic::ImageInfo::New();
image_info->width = sk_surface_->width();
image_info->height = sk_surface_->height();
image_info->stride = 4 * sk_surface_->width();
image_info->pixel_format = mozart2::ImageInfo::PixelFormat::BGRA_8;
image_info->color_space = mozart2::ImageInfo::ColorSpace::SRGB;
image_info->tiling = mozart2::ImageInfo::Tiling::LINEAR;
image_info->pixel_format = scenic::ImageInfo::PixelFormat::BGRA_8;
image_info->color_space = scenic::ImageInfo::ColorSpace::SRGB;
image_info->tiling = scenic::ImageInfo::Tiling::LINEAR;

session_image_ = std::make_unique<mozart::client::Image>(
session_image_ = std::make_unique<scenic_lib::Image>(
memory, 0 /* memory offset */, std::move(image_info));

return session_image_ != nullptr;
}

mozart::client::Image* VulkanSurface::GetImage() {
scenic_lib::Image* VulkanSurface::GetImage() {
ASSERT_IS_GPU_THREAD;
if (!valid_) {
return 0;
Expand Down
12 changes: 6 additions & 6 deletions content_handler/vulkan_surface.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#pragma once

#include <memory>
#include "apps/mozart/lib/scene/client/resources.h"
#include "apps/mozart/lib/scenic/client/resources.h"
#include "flutter/flow/scene_update_context.h"
#include "flutter/vulkan/vulkan_handle.h"
#include "flutter/vulkan/vulkan_proc_table.h"
Expand All @@ -25,7 +25,7 @@ class VulkanSurface : public flow::SceneUpdateContext::SurfaceProducerSurface,
VulkanSurface(vulkan::VulkanProcTable& p_vk,
sk_sp<GrContext> context,
sk_sp<GrVkBackendContext> backend_context,
mozart::client::Session* session,
scenic_lib::Session* session,
const SkISize& size);

~VulkanSurface() override;
Expand All @@ -44,19 +44,19 @@ class VulkanSurface : public flow::SceneUpdateContext::SurfaceProducerSurface,
std::function<void(void)> on_writes_committed) override;

// |flow::SceneUpdateContext::SurfaceProducerSurface|
mozart::client::Image* GetImage() override;
scenic_lib::Image* GetImage() override;

// |flow::SceneUpdateContext::SurfaceProducerSurface|
sk_sp<SkSurface> GetSkiaSurface() const override;

private:
vulkan::VulkanProcTable& vk_;
sk_sp<GrVkBackendContext> backend_context_;
mozart::client::Session* session_;
scenic_lib::Session* session_;
vulkan::VulkanHandle<VkImage> vk_image_;
vulkan::VulkanHandle<VkDeviceMemory> vk_memory_;
sk_sp<SkSurface> sk_surface_;
std::unique_ptr<mozart::client::Image> session_image_;
std::unique_ptr<scenic_lib::Image> session_image_;
mx::event acquire_event_;
mx::event release_event_;
mtl::MessageLoop::HandlerKey event_handler_key_ = 0;
Expand All @@ -80,7 +80,7 @@ class VulkanSurface : public flow::SceneUpdateContext::SurfaceProducerSurface,

bool CreateFences();

bool PushSessionImageSetupOps(mozart::client::Session* session,
bool PushSessionImageSetupOps(scenic_lib::Session* session,
mx::vmo exported_vmo);

void Reset();
Expand Down
2 changes: 1 addition & 1 deletion content_handler/vulkan_surface_pool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace flutter_runner {
VulkanSurfacePool::VulkanSurfacePool(vulkan::VulkanProcTable& p_vk,
sk_sp<GrContext> context,
sk_sp<GrVkBackendContext> backend_context,
mozart::client::Session* mozart_session)
scenic_lib::Session* mozart_session)
: vk_(p_vk),
context_(std::move(context)),
backend_context_(std::move(backend_context)),
Expand Down
4 changes: 2 additions & 2 deletions content_handler/vulkan_surface_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class VulkanSurfacePool {
VulkanSurfacePool(vulkan::VulkanProcTable& vk,
sk_sp<GrContext> context,
sk_sp<GrVkBackendContext> backend_context,
mozart::client::Session* mozart_session);
scenic_lib::Session* mozart_session);

~VulkanSurfacePool();

Expand Down Expand Up @@ -53,7 +53,7 @@ class VulkanSurfacePool {
vulkan::VulkanProcTable& vk_;
sk_sp<GrContext> context_;
sk_sp<GrVkBackendContext> backend_context_;
mozart::client::Session* mozart_session_;
scenic_lib::Session* mozart_session_;
std::unordered_map<SkISize, SurfacesSet, SkISizeHash> available_surfaces_;
std::unordered_map<
uintptr_t,
Expand Down
4 changes: 2 additions & 2 deletions content_handler/vulkan_surface_producer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
namespace flutter_runner {

VulkanSurfaceProducer::VulkanSurfaceProducer(
mozart::client::Session* mozart_session) {
scenic_lib::Session* mozart_session) {
valid_ = Initialize(mozart_session);

if (valid_) {
Expand All @@ -28,7 +28,7 @@ VulkanSurfaceProducer::VulkanSurfaceProducer(
VulkanSurfaceProducer::~VulkanSurfaceProducer() = default;

bool VulkanSurfaceProducer::Initialize(
mozart::client::Session* mozart_session) {
scenic_lib::Session* mozart_session) {
vk_ = ftl::MakeRefCounted<vulkan::VulkanProcTable>();

std::vector<std::string> extensions = {VK_KHR_SURFACE_EXTENSION_NAME};
Expand Down
8 changes: 4 additions & 4 deletions content_handler/vulkan_surface_producer.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#ifndef FLUTTER_CONTENT_HANDLER_VULKAN_SURFACE_PRODUCER_H_
#define FLUTTER_CONTENT_HANDLER_VULKAN_SURFACE_PRODUCER_H_

#include "apps/mozart/lib/scene/client/resources.h"
#include "apps/mozart/lib/scene/client/session.h"
#include "apps/mozart/lib/scenic/client/resources.h"
#include "apps/mozart/lib/scenic/client/session.h"
#include "flutter/content_handler/vulkan_surface.h"
#include "flutter/content_handler/vulkan_surface_pool.h"
#include "flutter/flow/scene_update_context.h"
Expand All @@ -21,7 +21,7 @@ namespace flutter_runner {

class VulkanSurfaceProducer : public flow::SceneUpdateContext::SurfaceProducer {
public:
VulkanSurfaceProducer(mozart::client::Session* mozart_session);
VulkanSurfaceProducer(scenic_lib::Session* mozart_session);

~VulkanSurfaceProducer();

Expand Down Expand Up @@ -56,7 +56,7 @@ class VulkanSurfaceProducer : public flow::SceneUpdateContext::SurfaceProducer {
std::unique_ptr<VulkanSurfacePool> surface_pool_;
bool valid_ = false;

bool Initialize(mozart::client::Session* mozart_session);
bool Initialize(scenic_lib::Session* mozart_session);

FTL_DISALLOW_COPY_AND_ASSIGN(VulkanSurfaceProducer);
};
Expand Down
4 changes: 2 additions & 2 deletions flow/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ source_set("flow") {
]

deps += [
"//apps/mozart/lib/scene:client",
"//apps/mozart/services/scene",
"//apps/mozart/lib/scenic:client",
"//apps/mozart/services/scenic",
"//garnet/public/lib/fidl/dart/sdk_ext",
]

Expand Down
Loading

0 comments on commit 321e68e

Please sign in to comment.