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

Unified Diff: Source/modules/performance/WorkerPerformance.cpp

Issue 16434011: Support performance.now() in workers. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix WorkerPerformance IDL Created 7 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
Index: Source/modules/performance/WorkerPerformance.cpp
diff --git a/Source/core/html/ime/Composition.cpp b/Source/modules/performance/WorkerPerformance.cpp
similarity index 79%
copy from Source/core/html/ime/Composition.cpp
copy to Source/modules/performance/WorkerPerformance.cpp
index e74501bcd8637afa85872dae701e91f04827e1ee..cd39e13ff2537529d167ec9ab7ff2408b1bc14ed 100644
--- a/Source/core/html/ime/Composition.cpp
+++ b/Source/modules/performance/WorkerPerformance.cpp
@@ -29,27 +29,26 @@
*/
#include "config.h"
-#include "core/html/ime/Composition.h"
+#include "modules/performance/WorkerPerformance.h"
-#include "core/dom/Node.h"
-#include "core/dom/Range.h"
+#include "core/workers/DedicatedWorkerContext.h"
+#include "core/workers/WorkerContext.h"
+#include "wtf/CurrentTime.h"
namespace WebCore {
-Composition::~Composition()
+WorkerPerformance::WorkerPerformance(WorkerContext* context)
+ : m_context(context)
{
}
-PassRefPtr<Composition> Composition::create(Node* text, Range* caret)
+WorkerPerformance::~WorkerPerformance()
{
- return adoptRef(new Composition(text, caret));
}
-Composition::Composition(Node* text, Range* caret)
- : m_text(text)
- , m_caret(caret)
+double WorkerPerformance::now() const
{
- ScriptWrappable::init(this);
+ return 1000.0 * (monotonicallyIncreasingTime() - m_context->timeOrigin());
}
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698