[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
aroben at apple.com
aroben at apple.com
Wed Dec 22 15:18:10 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 16a57f3026d759cd65093cad1c42b47c2b9dfe9a
Author: aroben at apple.com <aroben at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Oct 29 23:45:09 2010 +0000
Stop using encode/decodeBytes for WebEvent subclasses
The use of encode/decodeBytes was making these classes sensitive to
differences in padding on different architectures (e.g., 32-bit vs.
64-bit). By encoding each data member explicitly we remove this
sensitivity, allowing these classes to be passed between processes
with different padding.
Fixes <http://webkit.org/b/48552> <rdar://problem/8606571> Mouse
events never reach Flash in WebKit2 on Mac (asserts in Debug builds)
Reviewed by Anders Carlsson.
* Platform/CoreIPC/Arguments.h:
(CoreIPC::Arguments8::Arguments8):
(CoreIPC::Arguments8::encode):
(CoreIPC::Arguments8::decode):
(CoreIPC::In):
(CoreIPC::Out):
Added Arguments8, the biggest Arguments yet.
* Shared/WebEvent.cpp:
(WebKit::WebEvent::encode):
(WebKit::WebEvent::decode):
* Shared/WebKeyboardEvent.cpp:
(WebKit::WebKeyboardEvent::encode):
(WebKit::WebKeyboardEvent::decode):
* Shared/WebMouseEvent.cpp:
(WebKit::WebMouseEvent::encode):
(WebKit::WebMouseEvent::decode):
* Shared/WebPlatformTouchPoint.cpp:
(WebKit::WebPlatformTouchPoint::encode):
(WebKit::WebPlatformTouchPoint::decode):
* Shared/WebTouchEvent.cpp:
(WebKit::WebTouchEvent::encode):
(WebKit::WebTouchEvent::decode):
* Shared/WebWheelEvent.cpp:
(WebKit::WebWheelEvent::encode):
(WebKit::WebWheelEvent::decode):
Changed all encode/decode function to use CoreIPC::In/Out to
encode/decode data members individually.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70954 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index d1cb8e5..e5305e7 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,5 +1,49 @@
2010-10-29 Adam Roben <aroben at apple.com>
+ Stop using encode/decodeBytes for WebEvent subclasses
+
+ The use of encode/decodeBytes was making these classes sensitive to
+ differences in padding on different architectures (e.g., 32-bit vs.
+ 64-bit). By encoding each data member explicitly we remove this
+ sensitivity, allowing these classes to be passed between processes
+ with different padding.
+
+ Fixes <http://webkit.org/b/48552> <rdar://problem/8606571> Mouse
+ events never reach Flash in WebKit2 on Mac (asserts in Debug builds)
+
+ Reviewed by Anders Carlsson.
+
+ * Platform/CoreIPC/Arguments.h:
+ (CoreIPC::Arguments8::Arguments8):
+ (CoreIPC::Arguments8::encode):
+ (CoreIPC::Arguments8::decode):
+ (CoreIPC::In):
+ (CoreIPC::Out):
+ Added Arguments8, the biggest Arguments yet.
+
+ * Shared/WebEvent.cpp:
+ (WebKit::WebEvent::encode):
+ (WebKit::WebEvent::decode):
+ * Shared/WebKeyboardEvent.cpp:
+ (WebKit::WebKeyboardEvent::encode):
+ (WebKit::WebKeyboardEvent::decode):
+ * Shared/WebMouseEvent.cpp:
+ (WebKit::WebMouseEvent::encode):
+ (WebKit::WebMouseEvent::decode):
+ * Shared/WebPlatformTouchPoint.cpp:
+ (WebKit::WebPlatformTouchPoint::encode):
+ (WebKit::WebPlatformTouchPoint::decode):
+ * Shared/WebTouchEvent.cpp:
+ (WebKit::WebTouchEvent::encode):
+ (WebKit::WebTouchEvent::decode):
+ * Shared/WebWheelEvent.cpp:
+ (WebKit::WebWheelEvent::encode):
+ (WebKit::WebWheelEvent::decode):
+ Changed all encode/decode function to use CoreIPC::In/Out to
+ encode/decode data members individually.
+
+2010-10-29 Adam Roben <aroben at apple.com>
+
Use only CoreIPC-sanctioned types in WebEvent subclasses
Fixes <http://webkit.org//48694> WebEvent subclasses should not use
diff --git a/WebKit2/Platform/CoreIPC/Arguments.h b/WebKit2/Platform/CoreIPC/Arguments.h
index 000a5df..9ccd83c 100644
--- a/WebKit2/Platform/CoreIPC/Arguments.h
+++ b/WebKit2/Platform/CoreIPC/Arguments.h
@@ -351,6 +351,51 @@ template<typename T1, typename T2, typename T3, typename T4, typename T5, typena
return Arguments7<T1&, T2&, T3&, T4&, T5&, T6&, T7&>(t1, t2, t3, t4, t5, t6, t7);
}
+template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> struct Arguments8 : Arguments7<T1, T2, T3, T4, T5, T6, T7> {
+ typedef Arguments8<typename WTF::RemoveConst<typename WTF::RemoveReference<T1>::Type>::Type,
+ typename WTF::RemoveConst<typename WTF::RemoveReference<T2>::Type>::Type,
+ typename WTF::RemoveConst<typename WTF::RemoveReference<T3>::Type>::Type,
+ typename WTF::RemoveConst<typename WTF::RemoveReference<T4>::Type>::Type,
+ typename WTF::RemoveConst<typename WTF::RemoveReference<T5>::Type>::Type,
+ typename WTF::RemoveConst<typename WTF::RemoveReference<T6>::Type>::Type,
+ typename WTF::RemoveConst<typename WTF::RemoveReference<T7>::Type>::Type,
+ typename WTF::RemoveConst<typename WTF::RemoveReference<T8>::Type>::Type> ValueType;
+
+ Arguments8() { }
+
+ Arguments8(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8)
+ : Arguments7<T1, T2, T3, T4, T5, T6, T7>(t1, t2, t3, t4, t5, t6, t7)
+ , argument8(t8)
+ {
+ }
+
+ void encode(ArgumentEncoder* encoder) const
+ {
+ Arguments7<T1, T2, T3, T4, T5, T6, T7>::encode(encoder);
+ encoder->encode(argument8);
+ }
+
+ static bool decode(ArgumentDecoder* decoder, Arguments8& result)
+ {
+ if (!Arguments7<T1, T2, T3, T4, T5, T6, T7>::decode(decoder, result))
+ return false;
+
+ return decoder->decode(result.argument8);
+ }
+
+ T8 argument8;
+};
+
+template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> Arguments8<const T1&, const T2&, const T3&, const T4&, const T5&, const T6&, const T7&, const T8&> In(const T1& t1, const T2& t2, const T3 &t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8)
+{
+ return Arguments8<const T1&, const T2&, const T3&, const T4&, const T5&, const T6&, const T7&, const T8&>(t1, t2, t3, t4, t5, t6, t7, t8);
+}
+
+template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> Arguments8<T1&, T2&, T3&, T4&, T5&, T6&, T7&, T8&> Out(T1& t1, T2& t2, T3& t3, T4& t4, T5& t5, T6& t6, T7& t7, T8& t8)
+{
+ return Arguments8<T1&, T2&, T3&, T4&, T5&, T6&, T7&, T8&>(t1, t2, t3, t4, t5, t6, t7, t8);
+}
+
} // namespace CoreIPC
#endif // Arguments_h
diff --git a/WebKit2/Shared/WebEvent.cpp b/WebKit2/Shared/WebEvent.cpp
index 00f38f2..429622c 100644
--- a/WebKit2/Shared/WebEvent.cpp
+++ b/WebKit2/Shared/WebEvent.cpp
@@ -27,6 +27,7 @@
#include "ArgumentDecoder.h"
#include "ArgumentEncoder.h"
+#include "Arguments.h"
namespace WebKit {
@@ -39,21 +40,12 @@ WebEvent::WebEvent(Type type, Modifiers modifiers, double timestamp)
void WebEvent::encode(CoreIPC::ArgumentEncoder* encoder) const
{
- encoder->encode(m_type);
- encoder->encode(m_modifiers);
- encoder->encode(m_timestamp);
+ encoder->encode(CoreIPC::In(m_type, m_modifiers, m_timestamp));
}
bool WebEvent::decode(CoreIPC::ArgumentDecoder* decoder, WebEvent& t)
{
- if (!decoder->decode(t.m_type))
- return false;
- if (!decoder->decode(t.m_modifiers))
- return false;
- if (!decoder->decode(t.m_timestamp))
- return false;
-
- return true;
+ return decoder->decode(CoreIPC::Out(t.m_type, t.m_modifiers, t.m_timestamp));
}
} // namespace WebKit
diff --git a/WebKit2/Shared/WebKeyboardEvent.cpp b/WebKit2/Shared/WebKeyboardEvent.cpp
index 0859cdd..80d9f03 100644
--- a/WebKit2/Shared/WebKeyboardEvent.cpp
+++ b/WebKit2/Shared/WebKeyboardEvent.cpp
@@ -47,14 +47,7 @@ void WebKeyboardEvent::encode(CoreIPC::ArgumentEncoder* encoder) const
{
WebEvent::encode(encoder);
- encoder->encode(m_text);
- encoder->encode(m_unmodifiedText);
- encoder->encode(m_keyIdentifier);
- encoder->encode(m_windowsVirtualKeyCode);
- encoder->encode(m_nativeVirtualKeyCode);
- encoder->encode(m_isAutoRepeat);
- encoder->encode(m_isKeypad);
- encoder->encode(m_isSystemKey);
+ encoder->encode(CoreIPC::In(m_text, m_unmodifiedText, m_keyIdentifier, m_windowsVirtualKeyCode, m_nativeVirtualKeyCode, m_isAutoRepeat, m_isKeypad, m_isSystemKey));
}
bool WebKeyboardEvent::decode(CoreIPC::ArgumentDecoder* decoder, WebKeyboardEvent& t)
@@ -62,32 +55,7 @@ bool WebKeyboardEvent::decode(CoreIPC::ArgumentDecoder* decoder, WebKeyboardEven
if (!WebEvent::decode(decoder, t))
return false;
- String text;
- if (!decoder->decode(text))
- return false;
- t.m_text = text;
-
- String unmodifiedText;
- if (!decoder->decode(unmodifiedText))
- return false;
- t.m_unmodifiedText = unmodifiedText;
-
- String keyIdentifier;
- if (!decoder->decode(keyIdentifier))
- return false;
- t.m_keyIdentifier = keyIdentifier;
-
- if (!decoder->decode(t.m_windowsVirtualKeyCode))
- return false;
- if (!decoder->decode(t.m_nativeVirtualKeyCode))
- return false;
- if (!decoder->decode(t.m_isAutoRepeat))
- return false;
- if (!decoder->decode(t.m_isKeypad))
- return false;
- if (!decoder->decode(t.m_isSystemKey))
- return false;
- return true;
+ return decoder->decode(CoreIPC::Out(t.m_text, t.m_unmodifiedText, t.m_keyIdentifier, t.m_windowsVirtualKeyCode, t.m_nativeVirtualKeyCode, t.m_isAutoRepeat, t.m_isKeypad, t.m_isSystemKey));
}
bool WebKeyboardEvent::isKeyboardEventType(Type type)
diff --git a/WebKit2/Shared/WebMouseEvent.cpp b/WebKit2/Shared/WebMouseEvent.cpp
index faef18d..5bc12cd 100644
--- a/WebKit2/Shared/WebMouseEvent.cpp
+++ b/WebKit2/Shared/WebMouseEvent.cpp
@@ -25,8 +25,8 @@
#include "WebEvent.h"
-#include "ArgumentDecoder.h"
-#include "ArgumentEncoder.h"
+#include "Arguments.h"
+#include "WebCoreArgumentCoders.h"
using namespace WebCore;
@@ -47,12 +47,17 @@ WebMouseEvent::WebMouseEvent(Type type, Button button, const IntPoint& position,
void WebMouseEvent::encode(CoreIPC::ArgumentEncoder* encoder) const
{
- encoder->encodeBytes(reinterpret_cast<const uint8_t*>(this), sizeof(*this));
+ WebEvent::encode(encoder);
+
+ encoder->encode(CoreIPC::In(m_button, m_position, m_globalPosition, m_deltaX, m_deltaY, m_deltaZ, m_clickCount));
}
bool WebMouseEvent::decode(CoreIPC::ArgumentDecoder* decoder, WebMouseEvent& t)
{
- return decoder->decodeBytes(reinterpret_cast<uint8_t*>(&t), sizeof(t));
+ if (!WebEvent::decode(decoder, t))
+ return false;
+
+ return decoder->decode(CoreIPC::Out(t.m_button, t.m_position, t.m_globalPosition, t.m_deltaX, t.m_deltaY, t.m_deltaZ, t.m_clickCount));
}
bool WebMouseEvent::isMouseEventType(Type type)
diff --git a/WebKit2/Shared/WebPlatformTouchPoint.cpp b/WebKit2/Shared/WebPlatformTouchPoint.cpp
index b34f963..a974f84 100644
--- a/WebKit2/Shared/WebPlatformTouchPoint.cpp
+++ b/WebKit2/Shared/WebPlatformTouchPoint.cpp
@@ -27,8 +27,8 @@
#include "WebEvent.h"
-#include "ArgumentDecoder.h"
-#include "ArgumentEncoder.h"
+#include "Arguments.h"
+#include "WebCoreArgumentCoders.h"
using namespace WebCore;
@@ -44,12 +44,12 @@ WebPlatformTouchPoint::WebPlatformTouchPoint(unsigned id, TouchPointState state,
void WebPlatformTouchPoint::encode(CoreIPC::ArgumentEncoder* encoder) const
{
- encoder->encodeBytes(reinterpret_cast<const uint8_t*>(this), sizeof(*this));
+ encoder->encode(CoreIPC::In(m_id, m_state, m_screenPosition, m_position));
}
bool WebPlatformTouchPoint::decode(CoreIPC::ArgumentDecoder* decoder, WebPlatformTouchPoint& t)
{
- return decoder->decodeBytes(reinterpret_cast<uint8_t*>(&t), sizeof(t));
+ return decoder->decode(CoreIPC::Out(m_id, m_state, m_screenPosition, m_position));
}
} // namespace WebKit
diff --git a/WebKit2/Shared/WebTouchEvent.cpp b/WebKit2/Shared/WebTouchEvent.cpp
index 3b79ea9..6421243 100644
--- a/WebKit2/Shared/WebTouchEvent.cpp
+++ b/WebKit2/Shared/WebTouchEvent.cpp
@@ -28,6 +28,7 @@
#include "WebEvent.h"
#include "ArgumentCoders.h"
+#include "Arguments.h"
namespace WebKit {
@@ -45,18 +46,16 @@ WebTouchEvent::WebTouchEvent(WebEvent::Type type, Vector<WebPlatformTouchPoint>
void WebTouchEvent::encode(CoreIPC::ArgumentEncoder* encoder) const
{
WebEvent::encode(encoder);
- encoder->encode(m_touchPoints);
+
+ encoder->encode(CoreIPC::In(m_touchPoints));
}
bool WebTouchEvent::decode(CoreIPC::ArgumentDecoder* decoder, WebTouchEvent& t)
{
if (!WebEvent::decode(decoder, t))
return false;
-
- if (!decoder->decode(t.m_touchPoints))
- return false;
-
- return true;
+
+ return decoder->decode(CoreIPC::Out(t.m_touchPoints));
}
bool WebTouchEvent::isTouchEventType(Type type)
diff --git a/WebKit2/Shared/WebWheelEvent.cpp b/WebKit2/Shared/WebWheelEvent.cpp
index 93231f7..635c075 100644
--- a/WebKit2/Shared/WebWheelEvent.cpp
+++ b/WebKit2/Shared/WebWheelEvent.cpp
@@ -25,8 +25,8 @@
#include "WebEvent.h"
-#include "ArgumentDecoder.h"
-#include "ArgumentEncoder.h"
+#include "Arguments.h"
+#include "WebCoreArgumentCoders.h"
using namespace WebCore;
@@ -45,12 +45,17 @@ WebWheelEvent::WebWheelEvent(Type type, const IntPoint& position, const IntPoint
void WebWheelEvent::encode(CoreIPC::ArgumentEncoder* encoder) const
{
- encoder->encodeBytes(reinterpret_cast<const uint8_t*>(this), sizeof(*this));
+ WebEvent::encode(encoder);
+
+ encoder->encode(CoreIPC::In(m_position, m_globalPosition, m_delta, m_wheelTicks, m_granularity));
}
bool WebWheelEvent::decode(CoreIPC::ArgumentDecoder* decoder, WebWheelEvent& t)
{
- return decoder->decodeBytes(reinterpret_cast<uint8_t*>(&t), sizeof(t));
+ if (!WebEvent::decode(decoder, t))
+ return false;
+
+ return decoder->decode(CoreIPC::Out(t.m_position, t.m_globalPosition, t.m_delta, t.m_wheelTicks, t.m_granularity));
}
bool WebWheelEvent::isWheelEventType(Type type)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list