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

Unified Diff: mojo/examples/surfaces_app/surfaces_app.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
« no previous file with comments | « mojo/examples/sample_app/sample_app.cc ('k') | mojo/mojo_examples.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/examples/surfaces_app/surfaces_app.cc
diff --git a/mojo/examples/surfaces_app/surfaces_app.cc b/mojo/examples/surfaces_app/surfaces_app.cc
index f3b01e4fa782ab48c5d71a20e9510b13feabe8d4..d4e9b4a28f6e0fe9928728f376bccca5c4bdaab4 100644
--- a/mojo/examples/surfaces_app/surfaces_app.cc
+++ b/mojo/examples/surfaces_app/surfaces_app.cc
@@ -4,6 +4,7 @@
#include "base/bind.h"
#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
#include "base/message_loop/message_loop.h"
#include "cc/surfaces/surface_id_allocator.h"
#include "mojo/application/application_runner_chromium.h"
@@ -29,7 +30,7 @@ class SurfacesApp : public ApplicationDelegate,
public SurfaceClient,
public NativeViewportClient {
public:
- SurfacesApp() {}
+ SurfacesApp() : weak_factory_(this) {}
virtual ~SurfacesApp() {}
// ApplicationDelegate implementation
@@ -46,7 +47,9 @@ class SurfacesApp : public ApplicationDelegate,
size_ = gfx::Size(800, 600);
- viewport_->Create(Size::From(size_));
+ viewport_->Create(Size::From(size_),
+ base::Bind(&SurfacesApp::OnCreatedNativeViewport,
+ weak_factory_.GetWeakPtr()));
viewport_->Show();
child_size_ = gfx::Size(size_.width() / 3, size_.height() / 2);
@@ -103,8 +106,7 @@ class SurfacesApp : public ApplicationDelegate,
DCHECK(!resources.size());
}
// NativeViewportClient implementation.
- virtual void OnCreated(uint64_t native_viewport_id) OVERRIDE {}
- virtual void OnBoundsChanged(mojo::SizePtr bounds) OVERRIDE {}
+ virtual void OnSizeChanged(mojo::SizePtr size) OVERRIDE {}
virtual void OnDestroyed() OVERRIDE {}
virtual void OnEvent(mojo::EventPtr event,
const mojo::Callback<void()>& callback) OVERRIDE {
@@ -112,6 +114,8 @@ class SurfacesApp : public ApplicationDelegate,
}
private:
+ void OnCreatedNativeViewport(uint64_t native_viewport_id) {}
+
SurfacesServicePtr surfaces_service_;
SurfacePtr surface_;
cc::SurfaceId onscreen_id_;
@@ -126,6 +130,8 @@ class SurfacesApp : public ApplicationDelegate,
NativeViewportPtr viewport_;
+ base::WeakPtrFactory<SurfacesApp> weak_factory_;
+
DISALLOW_COPY_AND_ASSIGN(SurfacesApp);
};
« no previous file with comments | « mojo/examples/sample_app/sample_app.cc ('k') | mojo/mojo_examples.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698