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

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

Issue 380413003: Mojo: Use InterfaceFactory<Interface> for service registration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix network_service_loader Created 6 years, 5 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/services/launcher/launcher.cc ('k') | mojo/services/network/main.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/native_viewport/native_viewport_service.cc
diff --git a/mojo/services/native_viewport/native_viewport_service.cc b/mojo/services/native_viewport/native_viewport_service.cc
index bcde3aac7ec43ddda7770d29a372240d155ff921..cc971b7a9e15c5dde038c7fd3353b8715d24e565 100644
--- a/mojo/services/native_viewport/native_viewport_service.cc
+++ b/mojo/services/native_viewport/native_viewport_service.cc
@@ -9,6 +9,7 @@
#include "base/message_loop/message_loop.h"
#include "base/time/time.h"
#include "mojo/public/cpp/application/application_delegate.h"
+#include "mojo/public/cpp/application/interface_factory.h"
#include "mojo/public/interfaces/service_provider/service_provider.mojom.h"
#include "mojo/services/gles2/command_buffer_impl.h"
#include "mojo/services/native_viewport/native_viewport.h"
@@ -29,11 +30,10 @@ bool IsRateLimitedEventType(ui::Event* event) {
} // namespace
-class NativeViewportImpl
- : public InterfaceImpl<mojo::NativeViewport>,
- public NativeViewportDelegate {
+class NativeViewportImpl : public InterfaceImpl<mojo::NativeViewport>,
+ public NativeViewportDelegate {
public:
- explicit NativeViewportImpl(ApplicationConnection* connection)
+ NativeViewportImpl()
: widget_(gfx::kNullAcceleratedWidget),
waiting_for_event_ack_(false),
weak_factory_(this) {}
@@ -93,7 +93,7 @@ class NativeViewportImpl
return;
command_buffer_.reset(
new CommandBufferImpl(widget_, native_viewport_->GetSize()));
- BindToRequest(command_buffer_.get(), &command_buffer_request_);
+ WeakBindToRequest(command_buffer_.get(), &command_buffer_request_);
}
virtual bool OnEvent(ui::Event* ui_event) OVERRIDE {
@@ -151,16 +151,24 @@ class NativeViewportImpl
base::WeakPtrFactory<NativeViewportImpl> weak_factory_;
};
-class NVSDelegate : public ApplicationDelegate {
+class NVSDelegate : public ApplicationDelegate,
+ public InterfaceFactory<mojo::NativeViewport> {
public:
NVSDelegate() {}
virtual ~NVSDelegate() {}
+ // ApplicationDelegate implementation.
virtual bool ConfigureIncomingConnection(
- mojo::ApplicationConnection* connection) MOJO_OVERRIDE {
- connection->AddService<NativeViewportImpl>();
+ mojo::ApplicationConnection* connection) OVERRIDE {
+ connection->AddService(this);
return true;
}
+
+ // ServiceFactory<mojo::NativeViewport> implementation.
+ virtual void Create(ApplicationConnection* connection,
+ InterfaceRequest<mojo::NativeViewport> request) OVERRIDE {
+ BindToRequest(new NativeViewportImpl, &request);
+ }
};
MOJO_NATIVE_VIEWPORT_EXPORT mojo::ApplicationImpl*
« no previous file with comments | « mojo/services/launcher/launcher.cc ('k') | mojo/services/network/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698