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

Unified Diff: third_party/WebKit/Source/modules/gamepad/GamepadSharedMemoryReader.h

Issue 2580693003: Decouple GamepadSharedMemory into Blink.
Patch Set: Created 4 years 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: third_party/WebKit/Source/modules/gamepad/GamepadSharedMemoryReader.h
diff --git a/third_party/WebKit/Source/modules/gamepad/GamepadSharedMemoryReader.h b/third_party/WebKit/Source/modules/gamepad/GamepadSharedMemoryReader.h
new file mode 100644
index 0000000000000000000000000000000000000000..2eee9f35490542f2c54f0ec4640fba2b20ae7dfa
--- /dev/null
+++ b/third_party/WebKit/Source/modules/gamepad/GamepadSharedMemoryReader.h
@@ -0,0 +1,58 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef GamepadSharedMemoryReader_h
+#define GamepadSharedMemoryReader_h
+
+//#include "base/macros.h" //heke:DISALLOW_COPY_AND_ASSIGN
+#include "device/base/synchronization/shared_memory_seqlock_buffer.h"
+#include "device/gamepad/public/interfaces/gamepad.mojom-blink.h"
+#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/system/buffer.h"
+#include "public/platform/WebGamepadListener.h"
+#include "public/platform/WebGamepads.h"
+
+namespace blink {
+
+typedef device::SharedMemorySeqLockBuffer<WebGamepads> GamepadHardwareBuffer;
+
+class InterfaceProvider;
+
+class GamepadSharedMemoryReader final
+ : public device::mojom::blink::GamepadObserver { // heke:export?
+ // SampleGamepads..
+ public:
+ explicit GamepadSharedMemoryReader(InterfaceProvider*);
+ ~GamepadSharedMemoryReader() override;
+
+ void sampleGamepads(WebGamepads&);
+ void start(WebGamepadListener*);
+ void stop();
+
+ protected:
+ void sendStartMessage();
+ void sendStopMessage();
+
+ private:
+ // device::mojom::GamepadObserver methods.
+ void GamepadConnected(int index, const WebGamepad&) override;
+ void GamepadDisconnected(int index, const WebGamepad&) override;
+
+ mojo::ScopedSharedBufferHandle m_sharedBufferHandle;
+ mojo::ScopedSharedBufferMapping m_sharedBufferMapping;
+ GamepadHardwareBuffer* m_gamepadHardwareBuffer;
+
+ bool m_everInteracted;
+ bool m_isObserving;
+
+ mojo::Binding<device::mojom::blink::GamepadObserver> m_binding;
+ device::mojom::GamepadMonitorPtr m_gamepadMonitor;
+ WebGamepadListener* m_listener;
+
+ DISALLOW_COPY_AND_ASSIGN(GamepadSharedMemoryReader);
+};
+
+} // namespace blink
+
+#endif // GamepadSharedMemoryReader_h

Powered by Google App Engine
This is Rietveld 408576698