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..1e035b6610f7b7a8f55b940cf34037239c340486 100644 |
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
@@ -283,6 +283,22 @@ String preloadTypeToString(WebMediaPlayer::Preload preloadType) { |
return String(); |
} |
+class DisablePlaybackPositionUpdateScope { |
+ STACK_ALLOCATED(); |
+ |
+ public: |
+ DisablePlaybackPositionUpdateScope(bool* flag) |
+ : m_flag(flag), m_value(*flag) { |
+ *m_flag = false; |
+ } |
+ |
+ ~DisablePlaybackPositionUpdateScope() { *m_flag = m_value; } |
+ |
+ private: |
+ bool* m_flag; |
+ bool m_value; |
+}; |
+ |
} // anonymous namespace |
class HTMLMediaElement::AutoplayHelperClientImpl |
@@ -3458,9 +3474,17 @@ 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.) |
+ DisablePlaybackPositionUpdateScope scope( |
haraken
2016/11/16 06:47:26
Can we use AutoReset?
sof
2016/11/16 08:11:16
Thanks, I'd forgotten about TemporaryChange<> / Au
|
+ &m_officialPlaybackPositionNeedsUpdate); |
+ |
+ // 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) |