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

Unified Diff: Source/modules/gamepad/WebKitGamepad.h

Issue 195993007: Factor out GamepadCommon base class from Gamepad and WebKitGamepad (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add ABC FIXME Created 6 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 side-by-side diff with in-line comments
Download patch
Index: Source/modules/gamepad/WebKitGamepad.h
diff --git a/Source/modules/gamepad/WebKitGamepad.h b/Source/modules/gamepad/WebKitGamepad.h
index dff3f72d729492d1afde8392e5be50459e91a885..9ecb598f6c35418648374113336de33303b6f3f4 100644
--- a/Source/modules/gamepad/WebKitGamepad.h
+++ b/Source/modules/gamepad/WebKitGamepad.h
@@ -5,56 +5,34 @@
#ifndef WebKitGamepad_h
#define WebKitGamepad_h
-#include "bindings/v8/ScriptWrappable.h"
-#include "heap/Handle.h"
-#include "public/platform/WebGamepad.h"
-#include "wtf/RefCounted.h"
+#include "modules/gamepad/Gamepad.h"
#include "wtf/Vector.h"
-#include "wtf/text/WTFString.h"
namespace WebCore {
-class WebKitGamepad FINAL : public RefCountedWillBeGarbageCollectedFinalized<WebKitGamepad>, public ScriptWrappable {
+// Inherit from concrete Gamepad class (instead of factoring out an abstract
+// GamepadCommon class) so Gamepad is simple (unfactored) and low-cruft.
+class WebKitGamepad : public Gamepad {
public:
static PassRefPtrWillBeRawPtr<WebKitGamepad> create()
{
return adoptRefWillBeNoop(new WebKitGamepad);
}
- ~WebKitGamepad();
typedef Vector<float> FloatVector;
- const String& id() const { return m_id; }
- void setId(const String& id) { m_id = id; }
-
- unsigned index() const { return m_index; }
- void setIndex(unsigned val) { m_index = val; }
-
- bool connected() const { return m_connected; }
- void setConnected(bool val) { m_connected = val; }
-
- unsigned long long timestamp() const { return m_timestamp; }
- void setTimestamp(unsigned long long val) { m_timestamp = val; }
-
- const String& mapping() const { return m_mapping; }
- void setMapping(const String& val) { m_mapping = val; }
-
- const FloatVector& axes() const { return m_axes; }
- void setAxes(unsigned count, const float* data);
-
const FloatVector& buttons() const { return m_buttons; }
void setButtons(unsigned count, const blink::WebGamepadButton* data);
- void trace(Visitor*);
+ void trace(Visitor*) { };
haraken 2014/03/13 07:08:50 This should be: virtual void trace(Visitor* visit
Nils Barth (inactive) 2014/03/13 07:36:14 Got it; I'll actually factor this into the leaf cl
private:
- WebKitGamepad();
- String m_id;
- unsigned m_index;
- bool m_connected;
- unsigned long long m_timestamp;
- String m_mapping;
- FloatVector m_axes;
+ WebKitGamepad()
+ {
+ // FIXME: don't call ScriptWrappable::init twice
+ // Instead, factor out a base class GamepadCommon
haraken 2014/03/13 07:08:50 We want to handle this in this CL. Calling ScriptW
Nils Barth (inactive) 2014/03/13 07:36:14 Yes, I'm going to do so in this CL; just put a FIX
+ ScriptWrappable::init(this);
+ }
FloatVector m_buttons;
};

Powered by Google App Engine
This is Rietveld 408576698