Title: [125883] trunk/Source/WebCore
Revision
125883
Author
[email protected]
Date
2012-08-17 05:18:45 -0700 (Fri, 17 Aug 2012)

Log Message

[EFL] Remove alloca usage
https://bugs.webkit.org/show_bug.cgi?id=93931

Patch by Kangil Han <[email protected]> on 2012-08-17
Reviewed by Carlos Garcia Campos.

This patch is unifying the approaches for the creation of Edje_Message_Float_Set messages, and getting rid of alloca is part of it, since it is not portable.

* platform/efl/RenderThemeEfl.cpp:
(WebCore::RenderThemeEfl::paintThemePart):
* platform/efl/ScrollbarEfl.cpp:
(ScrollbarEfl::updateThumbPositionAndProportion):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (125882 => 125883)


--- trunk/Source/WebCore/ChangeLog	2012-08-17 12:08:17 UTC (rev 125882)
+++ trunk/Source/WebCore/ChangeLog	2012-08-17 12:18:45 UTC (rev 125883)
@@ -1,3 +1,17 @@
+2012-08-17  Kangil Han  <[email protected]>
+
+        [EFL] Remove alloca usage
+        https://bugs.webkit.org/show_bug.cgi?id=93931
+
+        Reviewed by Carlos Garcia Campos.
+
+        This patch is unifying the approaches for the creation of Edje_Message_Float_Set messages, and getting rid of alloca is part of it, since it is not portable.
+
+        * platform/efl/RenderThemeEfl.cpp:
+        (WebCore::RenderThemeEfl::paintThemePart):
+        * platform/efl/ScrollbarEfl.cpp:
+        (ScrollbarEfl::updateThumbPositionAndProportion):
+
 2012-08-17  Alexander Pavlov  <[email protected]>
 
         Web Inspector: hovering over an image link in Timeline popup kills popup

Modified: trunk/Source/WebCore/platform/efl/RenderThemeEfl.cpp (125882 => 125883)


--- trunk/Source/WebCore/platform/efl/RenderThemeEfl.cpp	2012-08-17 12:08:17 UTC (rev 125882)
+++ trunk/Source/WebCore/platform/efl/RenderThemeEfl.cpp	2012-08-17 12:18:45 UTC (rev 125883)
@@ -42,6 +42,7 @@
 
 #include <Ecore_Evas.h>
 #include <Edje.h>
+#include <new>
 #include <wtf/text/CString.h>
 #include <wtf/text/WTFString.h>
 
@@ -332,11 +333,12 @@
 
         RenderSlider* renderSlider = toRenderSlider(object);
         HTMLInputElement* input = renderSlider->node()->toInputElement();
-        Edje_Message_Float_Set* msg;
         double valueRange = input->maximum() - input->minimum();
 
-        msg = static_cast<Edje_Message_Float_Set*>(alloca(sizeof(Edje_Message_Float_Set) + sizeof(float)));
+        OwnArrayPtr<char> buffer = adoptArrayPtr(new char[sizeof(Edje_Message_Float_Set) + sizeof(double)]);
+        Edje_Message_Float_Set* msg = new(buffer.get()) Edje_Message_Float_Set;
         msg->count = 2;
+
         if (valueRange > 0)
             msg->val[0] = static_cast<float>((input->valueAsNumber() - input->minimum()) / valueRange);
         else
@@ -346,15 +348,14 @@
 #if ENABLE(PROGRESS_ELEMENT)
     } else if (type == ProgressBar) {
         RenderProgress* renderProgress = toRenderProgress(object);
-        Edje_Message_Float_Set* msg;
-        int max;
-        double value;
 
-        msg = static_cast<Edje_Message_Float_Set*>(alloca(sizeof(Edje_Message_Float_Set) + sizeof(float)));
-        max = rect.width();
-        value = renderProgress->position();
+        int max = rect.width();
+        double value = renderProgress->position();
 
+        OwnArrayPtr<char> buffer = adoptArrayPtr(new char[sizeof(Edje_Message_Float_Set) + sizeof(double)]);
+        Edje_Message_Float_Set* msg = new(buffer.get()) Edje_Message_Float_Set;
         msg->count = 2;
+
         if (object->style()->direction() == RTL)
             msg->val[0] = (1.0 - value) * max;
         else

Modified: trunk/Source/WebCore/platform/efl/ScrollbarEfl.cpp (125882 => 125883)


--- trunk/Source/WebCore/platform/efl/ScrollbarEfl.cpp	2012-08-17 12:08:17 UTC (rev 125882)
+++ trunk/Source/WebCore/platform/efl/ScrollbarEfl.cpp	2012-08-17 12:18:45 UTC (rev 125883)
@@ -36,6 +36,7 @@
 #include <Ecore.h>
 #include <Edje.h>
 #include <Evas.h>
+#include <new>
 #include <string>
 #include <wtf/text/CString.h>
 
@@ -171,8 +172,8 @@
     m_lastTotalSize = tSize;
     m_lastVisibleSize = vSize;
 
-    char buffer[sizeof(Edje_Message_Float_Set) + sizeof(double)];
-    Edje_Message_Float_Set* message = reinterpret_cast<Edje_Message_Float_Set*>(buffer);
+    OwnArrayPtr<char> buffer = adoptArrayPtr(new char[sizeof(Edje_Message_Float_Set) + sizeof(double)]);
+    Edje_Message_Float_Set* message = new(buffer.get()) Edje_Message_Float_Set;
     message->count = 2;
 
     if (tSize - vSize > 0)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to