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

Unified Diff: public/platform/WebFrameTime.h

Issue 321373003: Changing animate to beginFrame and use struct rather than naked double to allow extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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
« no previous file with comments | « Source/web/WebViewImpl.cpp ('k') | public/web/WebWidget.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: public/platform/WebFrameTime.h
diff --git a/public/platform/WebPoint.h b/public/platform/WebFrameTime.h
similarity index 60%
copy from public/platform/WebPoint.h
copy to public/platform/WebFrameTime.h
index 7424072f9ae02bd46211715d15093510809c357c..faf4544d88b90ec92eafaf4db967088229823212 100644
--- a/public/platform/WebPoint.h
+++ b/public/platform/WebFrameTime.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2014 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -28,84 +28,48 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebPoint_h
-#define WebPoint_h
+#ifndef WebFrameTime_h
+#define WebFrameTime_h
#include "WebCommon.h"
-#if INSIDE_BLINK
-#include "platform/geometry/IntPoint.h"
-#else
-#include <ui/gfx/point.h>
-#endif
-
namespace blink {
-struct WebPoint {
- int x;
- int y;
-
- WebPoint()
- : x(0)
- , y(0)
+struct WebFrameTime {
+ WebFrameTime(double flt, uint64_t d, uint64_t fdt)
abarth-chromium 2014/06/11 19:33:01 Please use complete words in variable names.
mithro-old 2014/06/18 03:36:44 Done.
+ : frameLastTime(flt)
+ , renderDeadline(d)
+ , frameDisplayTime(fdt)
{
}
- WebPoint(int x, int y)
- : x(x)
- , y(y)
- {
- }
+ // FIXME(mithro): Upgrade frame_time, deadline and frame_dispaly_time to TimeTick class.
abarth-chromium 2014/06/11 19:33:01 frame_time -> frameTime frame_dispaly_time -> fram
-#if INSIDE_BLINK
- WebPoint(const WebCore::IntPoint& p)
- : x(p.x())
- , y(p.y())
- {
- }
+ // Time in CLOCK_MONOTONIC that is the most recent vsync time.
+ double frameLastTime;
abarth-chromium 2014/06/11 19:33:01 lastFrameTime?
mithro-old 2014/06/18 03:36:44 Done.
- WebPoint& operator=(const WebCore::IntPoint& p)
- {
- x = p.x();
- y = p.y();
- return *this;
- }
+ // Time in CLOCK_MONOTONIC by which rendering must be finished by to not
+ // stall the pipeline.
+ double renderDeadline;
- operator WebCore::IntPoint() const
- {
- return WebCore::IntPoint(x, y);
- }
-#else
- WebPoint(const gfx::Point& p)
- : x(p.x())
- , y(p.y())
- {
- }
+ // Time in CLOCK_MONOTONIC that the frame will hit the glass of the display
+ // if rendered within the deadline. A value of NaN means we do not know and
+ // you should use frameLastTime instead.
+ double frameDisplayTime;
- WebPoint& operator=(const gfx::Point& p)
+ inline bool frameDisplayTimeValid()
abarth-chromium 2014/06/11 19:33:01 The keyword |inline| doesn't do anything there.
mithro-old 2014/06/18 03:36:44 I removed these functions and just made sure displ
{
- x = p.x();
- y = p.y();
- return *this;
+ return (frameDisplayTime == frameDisplayTime) && frameDisplayTime >= frameLastTime;
}
- operator gfx::Point() const
+ inline double frameTime()
abarth-chromium 2014/06/11 19:33:01 ditto
mithro-old 2014/06/18 03:36:44 Done.
{
- return gfx::Point(x, y);
+ if (frameDisplayTimeValid())
+ return frameDisplayTime;
+ return frameLastTime;
}
-#endif
};
-inline bool operator==(const WebPoint& a, const WebPoint& b)
-{
- return a.x == b.x && a.y == b.y;
-}
-
-inline bool operator!=(const WebPoint& a, const WebPoint& b)
-{
- return !(a == b);
-}
-
} // namespace blink
#endif
« no previous file with comments | « Source/web/WebViewImpl.cpp ('k') | public/web/WebWidget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698