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

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: Rebase 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 71%
copy from Source/core/html/ime/Composition.cpp
copy to Source/modules/performance/WorkerPerformance.cpp
index e74501bcd8637afa85872dae701e91f04827e1ee..21911532a910a86e10507e9c71a8f576bd588c36 100644
--- a/Source/core/html/ime/Composition.cpp
+++ b/Source/modules/performance/WorkerPerformance.cpp
@@ -29,27 +29,30 @@
*/
#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(ScriptExecutionContext* context)
+ : ContextDestructionObserver(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);
+ ScriptExecutionContext* context = scriptExecutionContext();
+ ASSERT(context);
+ ASSERT_WITH_SECURITY_IMPLICATION(context->isWorkerContext());
+ WorkerContext* workerContext = static_cast<WorkerContext*>(context);
+ return 1000.0 * (monotonicallyIncreasingTime() - workerContext->timeOrigin());
abarth-chromium 2013/06/13 22:27:16 I missed it the first time too, but it's here on t
}
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698