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

Unified Diff: components/native_viewport/main.cc

Issue 1139673003: Make Mandoline shut down cleanly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix crash in surfaces if surfaceimpl outlives the app, and a double delete in browser Created 5 years, 7 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: components/native_viewport/main.cc
diff --git a/components/native_viewport/main.cc b/components/native_viewport/main.cc
index 1ebfb270df26bcdf2c6dabb935e702953c9372db..89703cfb2448da8ced64dd96b99a22758ceaceb9 100644
--- a/components/native_viewport/main.cc
+++ b/components/native_viewport/main.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/bind.h"
#include "base/command_line.h"
#include "base/macros.h"
#include "base/message_loop/message_loop.h"
@@ -16,6 +17,7 @@
#include "third_party/mojo/src/mojo/public/cpp/application/application_impl.h"
#include "third_party/mojo/src/mojo/public/cpp/application/interface_factory_impl.h"
#include "ui/events/event_switches.h"
+#include "ui/events/platform/platform_event_source.h"
#include "ui/gl/gl_surface.h"
using mojo::ApplicationConnection;
@@ -34,6 +36,7 @@ class NativeViewportAppDelegate : public mojo::ApplicationDelegate,
private:
// mojo::ApplicationDelegate implementation.
void Initialize(mojo::ApplicationImpl* application) override {
+ event_source_ = ui::PlatformEventSource::CreateDefault();
jam 2015/05/13 19:55:09 this is moved to the app instead of NativeViewPort
tracing_.Initialize(application);
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
@@ -57,7 +60,10 @@ class NativeViewportAppDelegate : public mojo::ApplicationDelegate,
mojo::InterfaceRequest<NativeViewport> request) override {
if (!gpu_state_.get())
gpu_state_ = new gles2::GpuState;
- new NativeViewportImpl(is_headless_, gpu_state_, request.Pass());
+ new NativeViewportImpl(is_headless_,
+ gpu_state_,
+ request.Pass(),
+ app_lifetime_helper.CreateServiceRefCount());
}
// mojo::InterfaceFactory<Gpu> implementation.
@@ -69,8 +75,10 @@ class NativeViewportAppDelegate : public mojo::ApplicationDelegate,
}
scoped_refptr<gles2::GpuState> gpu_state_;
+ scoped_ptr<ui::PlatformEventSource> event_source_;
bool is_headless_;
mojo::TracingImpl tracing_;
+ mojo::AppLifetimeHelper app_lifetime_helper;
Ben Goodger (Google) 2015/05/13 20:21:07 app_lifetime_helper_
jam 2015/05/14 14:42:47 Done.
DISALLOW_COPY_AND_ASSIGN(NativeViewportAppDelegate);
};
« no previous file with comments | « no previous file | components/native_viewport/native_viewport_impl.h » ('j') | mojo/application/app_lifetime_helper.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698