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

Unified Diff: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp

Issue 2498033002: Media element: avoid v8 allocations in hasPendingActivity(). (Closed)
Patch Set: don't roll our own, use AutoReset<> Created 4 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
index c812addeafe4fcdf05b0df3990075b6e0e1ce6d5..f6c5b571db9c242e726b7444d4f0e96b68836ff6 100644
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -92,6 +92,7 @@
#include "public/platform/modules/remoteplayback/WebRemotePlaybackAvailability.h"
#include "public/platform/modules/remoteplayback/WebRemotePlaybackClient.h"
#include "public/platform/modules/remoteplayback/WebRemotePlaybackState.h"
+#include "wtf/AutoReset.h"
#include "wtf/CurrentTime.h"
#include "wtf/MathExtras.h"
#include "wtf/PtrUtil.h"
@@ -3458,9 +3459,16 @@ bool HTMLMediaElement::hasPendingActivity() const {
if (m_networkState == kNetworkLoading)
return true;
- // When playing or if playback may continue, timeupdate events may be fired.
- if (couldPlayIfEnoughData())
- return true;
+ {
+ // Disable potential updating of playback position, as that will
+ // require v8 allocations; not allowed while GCing
+ // (hasPendingActivity() is called during a v8 GC.)
+ AutoReset<bool> scope(&m_officialPlaybackPositionNeedsUpdate, false);
+
+ // When playing or if playback may continue, timeupdate events may be fired.
+ if (couldPlayIfEnoughData())
+ return true;
+ }
// When the seek finishes timeupdate and seeked events will be fired.
if (m_seeking)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698