Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Unified Diff: mojo/services/native_viewport/native_viewport_impl.cc

Issue 607233002: Nukes NativeViewportClient::OnCreated (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix build Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/services/native_viewport/native_viewport_impl.cc
diff --git a/mojo/services/native_viewport/native_viewport_impl.cc b/mojo/services/native_viewport/native_viewport_impl.cc
index 4fce13fccb6e009e86c198f1b70dc99f2b346659..6aba9ab0bb7dad8f263a15ec56bff6f75ee95b9d 100644
--- a/mojo/services/native_viewport/native_viewport_impl.cc
+++ b/mojo/services/native_viewport/native_viewport_impl.cc
@@ -45,14 +45,16 @@ NativeViewportImpl::~NativeViewportImpl() {
platform_viewport_.reset();
}
-void NativeViewportImpl::Create(SizePtr bounds) {
+void NativeViewportImpl::Create(SizePtr size,
+ const Callback<void(uint64_t)>& callback) {
+ create_callback_ = callback;
if (is_headless_)
platform_viewport_ = PlatformViewportHeadless::Create(this);
else
platform_viewport_ = PlatformViewport::Create(this);
- gfx::Rect rect = gfx::Rect(bounds.To<gfx::Size>());
- platform_viewport_->Init(rect);
- OnBoundsChanged(rect);
+ const gfx::Rect bounds(gfx::Rect(size.To<gfx::Size>()));
+ platform_viewport_->Init(bounds);
+ OnBoundsChanged(bounds);
}
void NativeViewportImpl::Show() {
@@ -68,8 +70,8 @@ void NativeViewportImpl::Close() {
platform_viewport_->Close();
}
-void NativeViewportImpl::SetBounds(SizePtr bounds) {
- platform_viewport_->SetBounds(gfx::Rect(bounds.To<gfx::Size>()));
+void NativeViewportImpl::SetSize(SizePtr size) {
+ platform_viewport_->SetBounds(gfx::Rect(size.To<gfx::Size>()));
}
void NativeViewportImpl::SubmittedFrame(SurfaceIdPtr child_surface_id) {
@@ -81,7 +83,7 @@ void NativeViewportImpl::SubmittedFrame(SurfaceIdPtr child_surface_id) {
viewport_surface_.reset(
new ViewportSurface(surfaces_service_.get(),
gpu_service_.get(),
- bounds_.size(),
+ size_,
child_surface_id.To<cc::SurfaceId>()));
if (widget_id_)
viewport_surface_->SetWidgetId(widget_id_);
@@ -92,17 +94,17 @@ void NativeViewportImpl::SubmittedFrame(SurfaceIdPtr child_surface_id) {
}
void NativeViewportImpl::OnBoundsChanged(const gfx::Rect& bounds) {
- bounds_ = bounds;
- client()->OnBoundsChanged(Size::From(bounds.size()));
+ size_ = bounds.size();
+ client()->OnSizeChanged(Size::From(size_));
if (viewport_surface_)
- viewport_surface_->SetSize(bounds.size());
+ viewport_surface_->SetSize(size_);
}
void NativeViewportImpl::OnAcceleratedWidgetAvailable(
gfx::AcceleratedWidget widget) {
widget_id_ = static_cast<uint64_t>(bit_cast<uintptr_t>(widget));
// TODO(jamesr): Remove once everything is converted to surfaces.
- client()->OnCreated(widget_id_);
+ create_callback_.Run(widget_id_);
if (viewport_surface_)
viewport_surface_->SetWidgetId(widget_id_);
}

Powered by Google App Engine
This is Rietveld 408576698