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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 #include "platform/weborigin/SecurityOrigin.h" 85 #include "platform/weborigin/SecurityOrigin.h"
86 #include "public/platform/Platform.h" 86 #include "public/platform/Platform.h"
87 #include "public/platform/WebAudioSourceProvider.h" 87 #include "public/platform/WebAudioSourceProvider.h"
88 #include "public/platform/WebContentDecryptionModule.h" 88 #include "public/platform/WebContentDecryptionModule.h"
89 #include "public/platform/WebInbandTextTrack.h" 89 #include "public/platform/WebInbandTextTrack.h"
90 #include "public/platform/WebMediaPlayerSource.h" 90 #include "public/platform/WebMediaPlayerSource.h"
91 #include "public/platform/WebMediaStream.h" 91 #include "public/platform/WebMediaStream.h"
92 #include "public/platform/modules/remoteplayback/WebRemotePlaybackAvailability.h " 92 #include "public/platform/modules/remoteplayback/WebRemotePlaybackAvailability.h "
93 #include "public/platform/modules/remoteplayback/WebRemotePlaybackClient.h" 93 #include "public/platform/modules/remoteplayback/WebRemotePlaybackClient.h"
94 #include "public/platform/modules/remoteplayback/WebRemotePlaybackState.h" 94 #include "public/platform/modules/remoteplayback/WebRemotePlaybackState.h"
95 #include "wtf/AutoReset.h"
95 #include "wtf/CurrentTime.h" 96 #include "wtf/CurrentTime.h"
96 #include "wtf/MathExtras.h" 97 #include "wtf/MathExtras.h"
97 #include "wtf/PtrUtil.h" 98 #include "wtf/PtrUtil.h"
98 #include "wtf/text/CString.h" 99 #include "wtf/text/CString.h"
99 #include <limits> 100 #include <limits>
100 101
101 #ifndef BLINK_MEDIA_LOG 102 #ifndef BLINK_MEDIA_LOG
102 #define BLINK_MEDIA_LOG DVLOG(3) 103 #define BLINK_MEDIA_LOG DVLOG(3)
103 #endif 104 #endif
104 105
(...skipping 3346 matching lines...) Expand 10 before | Expand all | Expand 10 after
3451 // when looking for a resource to load, before networkState has reached to 3452 // when looking for a resource to load, before networkState has reached to
3452 // kNetworkLoading. 3453 // kNetworkLoading.
3453 if (m_shouldDelayLoadEvent) 3454 if (m_shouldDelayLoadEvent)
3454 return true; 3455 return true;
3455 3456
3456 // When networkState is kNetworkLoading, progress and stalled events may be 3457 // When networkState is kNetworkLoading, progress and stalled events may be
3457 // fired. 3458 // fired.
3458 if (m_networkState == kNetworkLoading) 3459 if (m_networkState == kNetworkLoading)
3459 return true; 3460 return true;
3460 3461
3461 // When playing or if playback may continue, timeupdate events may be fired. 3462 {
3462 if (couldPlayIfEnoughData()) 3463 // Disable potential updating of playback position, as that will
3463 return true; 3464 // require v8 allocations; not allowed while GCing
3465 // (hasPendingActivity() is called during a v8 GC.)
3466 AutoReset<bool> scope(&m_officialPlaybackPositionNeedsUpdate, false);
3467
3468 // When playing or if playback may continue, timeupdate events may be fired.
3469 if (couldPlayIfEnoughData())
3470 return true;
3471 }
3464 3472
3465 // When the seek finishes timeupdate and seeked events will be fired. 3473 // When the seek finishes timeupdate and seeked events will be fired.
3466 if (m_seeking) 3474 if (m_seeking)
3467 return true; 3475 return true;
3468 3476
3469 // When connected to a MediaSource, e.g. setting MediaSource.duration will 3477 // When connected to a MediaSource, e.g. setting MediaSource.duration will
3470 // cause a durationchange event to be fired. 3478 // cause a durationchange event to be fired.
3471 if (m_mediaSource) 3479 if (m_mediaSource)
3472 return true; 3480 return true;
3473 3481
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
4192 4200
4193 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() 4201 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect()
4194 const { 4202 const {
4195 IntRect result; 4203 IntRect result;
4196 if (LayoutObject* object = m_element->layoutObject()) 4204 if (LayoutObject* object = m_element->layoutObject())
4197 result = object->absoluteBoundingBoxRect(); 4205 result = object->absoluteBoundingBoxRect();
4198 return result; 4206 return result;
4199 } 4207 }
4200 4208
4201 } // namespace blink 4209 } // namespace blink
OLDNEW
« 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