[BlackBerry] Add timing logs to SelectionHandler.
authormifenton@rim.com <mifenton@rim.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Jul 2012 20:19:39 +0000 (20:19 +0000)
committermifenton@rim.com <mifenton@rim.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Jul 2012 20:19:39 +0000 (20:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=92404

Reviewed by Rob Buis.

Add selection timing logs.

Reviewed Internally by Nima Ghanavatian.

* WebKitSupport/SelectionHandler.cpp:
(BlackBerry::WebKit::SelectionHandler::setSelection):
(BlackBerry::WebKit::SelectionHandler::selectionPositionChanged):
* WebKitSupport/SelectionHandler.h:
(SelectionHandler):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@123787 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/blackberry/ChangeLog
Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp
Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h

index 4bdee34..4844745 100644 (file)
@@ -1,5 +1,22 @@
 2012-07-26  Mike Fenton  <mifenton@rim.com>
 
+        [BlackBerry] Add timing logs to SelectionHandler.
+        https://bugs.webkit.org/show_bug.cgi?id=92404
+
+        Reviewed by Rob Buis.
+
+        Add selection timing logs.
+
+        Reviewed Internally by Nima Ghanavatian.
+
+        * WebKitSupport/SelectionHandler.cpp:
+        (BlackBerry::WebKit::SelectionHandler::setSelection):
+        (BlackBerry::WebKit::SelectionHandler::selectionPositionChanged):
+        * WebKitSupport/SelectionHandler.h:
+        (SelectionHandler):
+
+2012-07-26  Mike Fenton  <mifenton@rim.com>
+
         [BlackBerry] InputHandler failure logs should be logAlways and critical.
         https://bugs.webkit.org/show_bug.cgi?id=92403
 
index 51c9b72..4b2fd72 100644 (file)
@@ -45,6 +45,7 @@
 // Note: This generates a lot of logs when dumping rects lists. It will seriously
 // impact performance. Do not enable this during performance tests.
 #define SHOWDEBUG_SELECTIONHANDLER 0
+#define SHOWDEBUG_SELECTIONHANDLER_TIMING 0
 
 using namespace BlackBerry::Platform;
 using namespace WebCore;
@@ -55,6 +56,12 @@ using namespace WebCore;
 #define DEBUG_SELECTION(severity, format, ...)
 #endif // SHOWDEBUG_SELECTIONHANDLER
 
+#if SHOWDEBUG_SELECTIONHANDLER_TIMING
+#define DEBUG_SELECTION_TIMING(severity, format, ...) logAlways(severity, format, ## __VA_ARGS__)
+#else
+#define DEBUG_SELECTION_TIMING(severity, format, ...)
+#endif // SHOWDEBUG_SELECTIONHANDLER_TIMING
+
 namespace BlackBerry {
 namespace WebKit {
 
@@ -448,6 +455,10 @@ void SelectionHandler::setSelection(const WebCore::IntPoint& start, const WebCor
     Frame* focusedFrame = m_webPage->focusedOrMainFrame();
     FrameSelection* controller = focusedFrame->selection();
 
+#if SHOWDEBUG_SELECTIONHANDLER_TIMING
+    m_timer.start();
+#endif
+
     DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::setSelection adjusted points %d, %d, %d, %d", start.x(), start.y(), end.x(), end.y());
 
     // Note that IntPoint(-1, -1) is being our sentinel so far for
@@ -858,6 +869,8 @@ void SelectionHandler::selectionPositionChanged(bool visualChangeOnly)
     else if (!m_selectionActive)
         return;
 
+    DEBUG_SELECTION_TIMING(LogLevelInfo, "SelectionHandler::selectionPositionChanged starting at %f", m_timer.elapsed());
+
     WebCore::IntRect startCaret;
     WebCore::IntRect endCaret;
 
@@ -929,6 +942,7 @@ void SelectionHandler::selectionPositionChanged(bool visualChangeOnly)
         m_webPage->m_selectionOverlay->draw(visibleSelectionRegion);
 
     m_webPage->m_client->notifySelectionDetailsChanged(startCaret, endCaret, visibleSelectionRegion, inputNodeOverridesTouch());
+    DEBUG_SELECTION_TIMING(LogLevelInfo, "SelectionHandler::selectionPositionChanged completed at %f", m_timer.elapsed());
 }
 
 // NOTE: This function is not in WebKit coordinates.
index f72af44..b0833c2 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "BlackBerryPlatformIntRectRegion.h"
 #include "BlackBerryPlatformPrimitives.h"
+#include "BlackBerryPlatformStopWatch.h"
 #include "TextGranularity.h"
 
 #include <wtf/Vector.h>
@@ -89,6 +90,8 @@ private:
     bool m_caretActive;
     bool m_lastUpdatedEndPointIsValid;
     BlackBerry::Platform::IntRectRegion m_lastSelectionRegion;
+
+    BlackBerry::Platform::StopWatch m_timer;
 };
 
 }