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

Side by Side Diff: content/renderer/gamepad_shared_memory_reader.cc

Issue 2755813002: Begin to wean child processes off reliance on a persistent service_manager::Connection to the brows… (Closed)
Patch Set: . Created 3 years, 9 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/renderer/gamepad_shared_memory_reader.h" 5 #include "content/renderer/gamepad_shared_memory_reader.h"
6 6
7 #include "base/metrics/histogram_macros.h" 7 #include "base/metrics/histogram_macros.h"
8 #include "base/trace_event/trace_event.h" 8 #include "base/trace_event/trace_event.h"
9 #include "content/public/common/service_names.mojom.h"
9 #include "content/public/renderer/render_thread.h" 10 #include "content/public/renderer/render_thread.h"
10 #include "content/renderer/renderer_blink_platform_impl.h" 11 #include "content/renderer/renderer_blink_platform_impl.h"
11 #include "ipc/ipc_sync_message_filter.h" 12 #include "ipc/ipc_sync_message_filter.h"
12 #include "services/service_manager/public/cpp/interface_provider.h" 13 #include "services/service_manager/public/cpp/connector.h"
13 #include "third_party/WebKit/public/platform/WebGamepadListener.h" 14 #include "third_party/WebKit/public/platform/WebGamepadListener.h"
14 #include "third_party/WebKit/public/platform/WebPlatformEventListener.h" 15 #include "third_party/WebKit/public/platform/WebPlatformEventListener.h"
15 16
16 namespace content { 17 namespace content {
17 18
18 GamepadSharedMemoryReader::GamepadSharedMemoryReader(RenderThread* thread) 19 GamepadSharedMemoryReader::GamepadSharedMemoryReader(RenderThread* thread)
19 : RendererGamepadProvider(thread), 20 : RendererGamepadProvider(thread),
20 gamepad_hardware_buffer_(NULL), 21 gamepad_hardware_buffer_(NULL),
21 ever_interacted_with_(false), 22 ever_interacted_with_(false),
22 binding_(this) { 23 binding_(this) {
23 if (thread) { 24 if (thread) {
24 thread->GetRemoteInterfaces()->GetInterface( 25 thread->GetConnector()->BindInterface(mojom::kBrowserServiceName,
25 mojo::MakeRequest(&gamepad_monitor_)); 26 mojo::MakeRequest(&gamepad_monitor_));
26 gamepad_monitor_->SetObserver(binding_.CreateInterfacePtrAndBind()); 27 gamepad_monitor_->SetObserver(binding_.CreateInterfacePtrAndBind());
27 } 28 }
28 } 29 }
29 30
30 void GamepadSharedMemoryReader::SendStartMessage() { 31 void GamepadSharedMemoryReader::SendStartMessage() {
31 if (gamepad_monitor_) { 32 if (gamepad_monitor_) {
32 gamepad_monitor_->GamepadStartPolling(&renderer_shared_buffer_handle_); 33 gamepad_monitor_->GamepadStartPolling(&renderer_shared_buffer_handle_);
33 } 34 }
34 } 35 }
35 36
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 } 127 }
127 128
128 void GamepadSharedMemoryReader::GamepadDisconnected( 129 void GamepadSharedMemoryReader::GamepadDisconnected(
129 int index, 130 int index,
130 const blink::WebGamepad& gamepad) { 131 const blink::WebGamepad& gamepad) {
131 if (listener()) 132 if (listener())
132 listener()->didDisconnectGamepad(index, gamepad); 133 listener()->didDisconnectGamepad(index, gamepad);
133 } 134 }
134 135
135 } // namespace content 136 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/device_sensors/device_sensor_event_pump.h ('k') | content/renderer/media/video_capture_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698