flutter_flutter/sky/shell/gpu/direct/surface_notifications_direct.cc
Adam Barth 56601fcfa3 Wire sky_shell.mojo to draw via MGL
After this patch, we can execute Dart code and draw the result via MGL. We
still need to plumb in services.
2015-11-14 07:42:25 -08:00

38 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.
#include "sky/shell/gpu/direct/surface_notifications_direct.h"
#include "base/bind.h"
#include "base/location.h"
#include "sky/shell/shell.h"
#include "base/single_thread_task_runner.h"
#include "sky/shell/gpu/direct/rasterizer_direct.h"
namespace sky {
namespace shell {
void SurfaceNotificationsDirect::NotifyCreated(
const PlatformView::Config& config, gfx::AcceleratedWidget widget) {
RasterizerDirect* rasterizer = static_cast<RasterizerDirect*>(config.rasterizer);
config.ui_task_runner->PostTask(
FROM_HERE, base::Bind(&UIDelegate::OnOutputSurfaceCreated,
config.ui_delegate,
base::Bind(&RasterizerDirect::OnAcceleratedWidgetAvailable,
rasterizer->GetWeakPtr(), widget)));
}
void SurfaceNotificationsDirect::NotifyDestroyed(
const PlatformView::Config& config) {
RasterizerDirect* rasterizer = static_cast<RasterizerDirect*>(config.rasterizer);
config.ui_task_runner->PostTask(
FROM_HERE, base::Bind(&UIDelegate::OnOutputSurfaceDestroyed,
config.ui_delegate,
base::Bind(&RasterizerDirect::OnOutputSurfaceDestroyed,
rasterizer->GetWeakPtr())));
}
} // namespace shell
} // namespace sky