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

Side by Side Diff: mojo/services/native_viewport/native_viewport_service.cc

Issue 109103003: Mojo: abstract interface implementation from generated Stub classes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « mojo/services/native_viewport/native_viewport_service.h ('k') | mojo/shell/service_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mojo/services/native_viewport/native_viewport_service.h" 5 #include "mojo/services/native_viewport/native_viewport_service.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "mojo/common/bindings_support_impl.h" 9 #include "mojo/common/bindings_support_impl.h"
10 #include "mojo/services/gles2/gles2_impl.h" 10 #include "mojo/services/gles2/gles2_impl.h"
11 #include "mojo/services/native_viewport/native_viewport.h" 11 #include "mojo/services/native_viewport/native_viewport.h"
12 #include "mojom/native_viewport.h" 12 #include "mojom/native_viewport.h"
13 #include "ui/events/event.h" 13 #include "ui/events/event.h"
14 14
15 namespace mojo { 15 namespace mojo {
16 namespace services { 16 namespace services {
17 namespace { 17 namespace {
18 18
19 bool IsRateLimitedEventType(ui::Event* event) { 19 bool IsRateLimitedEventType(ui::Event* event) {
20 return event->type() == ui::ET_MOUSE_MOVED || 20 return event->type() == ui::ET_MOUSE_MOVED ||
21 event->type() == ui::ET_MOUSE_DRAGGED || 21 event->type() == ui::ET_MOUSE_DRAGGED ||
22 event->type() == ui::ET_TOUCH_MOVED; 22 event->type() == ui::ET_TOUCH_MOVED;
23 } 23 }
24 24
25 } 25 }
26 26
27 class NativeViewportService::NativeViewportImpl 27 class NativeViewportService::NativeViewportImpl
28 : public NativeViewportStub, 28 : public mojo::NativeViewport,
DaveMoore 2013/12/27 17:58:55 I think we're going to find ourselves with these k
29 public NativeViewportDelegate { 29 public NativeViewportDelegate {
30 public: 30 public:
31 NativeViewportImpl(NativeViewportService* service, 31 NativeViewportImpl(NativeViewportService* service,
32 ScopedMessagePipeHandle client_handle) 32 ScopedMessagePipeHandle client_handle)
33 : service_(service), 33 : service_(service),
34 widget_(gfx::kNullAcceleratedWidget), 34 widget_(gfx::kNullAcceleratedWidget),
35 waiting_for_event_ack_(false), 35 waiting_for_event_ack_(false),
36 pending_event_timestamp_(0), 36 pending_event_timestamp_(0),
37 client_(client_handle.Pass()) { 37 client_(client_handle.Pass(), this) {
38 client_.SetPeer(this);
39 } 38 }
40 virtual ~NativeViewportImpl() {} 39 virtual ~NativeViewportImpl() {}
41 40
42 virtual void Open() MOJO_OVERRIDE { 41 virtual void Open() MOJO_OVERRIDE {
43 native_viewport_ = 42 native_viewport_ =
44 services::NativeViewport::Create(service_->context_, this); 43 services::NativeViewport::Create(service_->context_, this);
45 native_viewport_->Init(); 44 native_viewport_->Init();
46 client_->OnCreated(); 45 client_->OnCreated();
47 } 46 }
48 47
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 scoped_ptr<services::NativeViewport> native_viewport_; 147 scoped_ptr<services::NativeViewport> native_viewport_;
149 scoped_ptr<GLES2Impl> gles2_; 148 scoped_ptr<GLES2Impl> gles2_;
150 bool waiting_for_event_ack_; 149 bool waiting_for_event_ack_;
151 int64 pending_event_timestamp_; 150 int64 pending_event_timestamp_;
152 151
153 RemotePtr<NativeViewportClient> client_; 152 RemotePtr<NativeViewportClient> client_;
154 }; 153 };
155 154
156 NativeViewportService::NativeViewportService( 155 NativeViewportService::NativeViewportService(
157 ScopedMessagePipeHandle shell_handle) 156 ScopedMessagePipeHandle shell_handle)
158 : shell_(shell_handle.Pass()), 157 : shell_(shell_handle.Pass(), this),
159 context_(NULL) { 158 context_(NULL) {
160 shell_.SetPeer(this);
161 } 159 }
162 160
163 NativeViewportService::~NativeViewportService() {} 161 NativeViewportService::~NativeViewportService() {}
164 162
165 void NativeViewportService::AcceptConnection( 163 void NativeViewportService::AcceptConnection(
166 ScopedMessagePipeHandle client_handle) { 164 ScopedMessagePipeHandle client_handle) {
167 // TODO(davemoore): We need a mechanism to determine when connectors 165 // TODO(davemoore): We need a mechanism to determine when connectors
168 // go away, so we can remove viewports correctly. 166 // go away, so we can remove viewports correctly.
169 viewports_.push_back(new NativeViewportImpl(this, client_handle.Pass())); 167 viewports_.push_back(new NativeViewportImpl(this, client_handle.Pass()));
170 } 168 }
(...skipping 19 matching lines...) Expand all
190 base::MessageLoopForUI loop; 188 base::MessageLoopForUI loop;
191 mojo::services::NativeViewportService app( 189 mojo::services::NativeViewportService app(
192 mojo::MakeScopedHandle(mojo::MessagePipeHandle(shell_handle)).Pass()); 190 mojo::MakeScopedHandle(mojo::MessagePipeHandle(shell_handle)).Pass());
193 base::MessageLoop::current()->Run(); 191 base::MessageLoop::current()->Run();
194 192
195 mojo::BindingsSupport::Set(NULL); 193 mojo::BindingsSupport::Set(NULL);
196 return MOJO_RESULT_OK; 194 return MOJO_RESULT_OK;
197 } 195 }
198 196
199 #endif // !OS_ANDROID 197 #endif // !OS_ANDROID
OLDNEW
« no previous file with comments | « mojo/services/native_viewport/native_viewport_service.h ('k') | mojo/shell/service_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698