Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 276 case WebMediaPlayer::PreloadMetaData: | 276 case WebMediaPlayer::PreloadMetaData: |
| 277 return "metadata"; | 277 return "metadata"; |
| 278 case WebMediaPlayer::PreloadAuto: | 278 case WebMediaPlayer::PreloadAuto: |
| 279 return "auto"; | 279 return "auto"; |
| 280 } | 280 } |
| 281 | 281 |
| 282 NOTREACHED(); | 282 NOTREACHED(); |
| 283 return String(); | 283 return String(); |
| 284 } | 284 } |
| 285 | 285 |
| 286 class DisablePlaybackPositionUpdateScope { | |
| 287 STACK_ALLOCATED(); | |
| 288 | |
| 289 public: | |
| 290 DisablePlaybackPositionUpdateScope(bool* flag) | |
| 291 : m_flag(flag), m_value(*flag) { | |
| 292 *m_flag = false; | |
| 293 } | |
| 294 | |
| 295 ~DisablePlaybackPositionUpdateScope() { *m_flag = m_value; } | |
| 296 | |
| 297 private: | |
| 298 bool* m_flag; | |
| 299 bool m_value; | |
| 300 }; | |
| 301 | |
| 286 } // anonymous namespace | 302 } // anonymous namespace |
| 287 | 303 |
| 288 class HTMLMediaElement::AutoplayHelperClientImpl | 304 class HTMLMediaElement::AutoplayHelperClientImpl |
| 289 : public AutoplayExperimentHelper::Client { | 305 : public AutoplayExperimentHelper::Client { |
| 290 public: | 306 public: |
| 291 static AutoplayHelperClientImpl* create(HTMLMediaElement* element) { | 307 static AutoplayHelperClientImpl* create(HTMLMediaElement* element) { |
| 292 return new AutoplayHelperClientImpl(element); | 308 return new AutoplayHelperClientImpl(element); |
| 293 } | 309 } |
| 294 | 310 |
| 295 virtual ~AutoplayHelperClientImpl(); | 311 virtual ~AutoplayHelperClientImpl(); |
| (...skipping 3155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3451 // when looking for a resource to load, before networkState has reached to | 3467 // when looking for a resource to load, before networkState has reached to |
| 3452 // kNetworkLoading. | 3468 // kNetworkLoading. |
| 3453 if (m_shouldDelayLoadEvent) | 3469 if (m_shouldDelayLoadEvent) |
| 3454 return true; | 3470 return true; |
| 3455 | 3471 |
| 3456 // When networkState is kNetworkLoading, progress and stalled events may be | 3472 // When networkState is kNetworkLoading, progress and stalled events may be |
| 3457 // fired. | 3473 // fired. |
| 3458 if (m_networkState == kNetworkLoading) | 3474 if (m_networkState == kNetworkLoading) |
| 3459 return true; | 3475 return true; |
| 3460 | 3476 |
| 3461 // When playing or if playback may continue, timeupdate events may be fired. | 3477 { |
| 3462 if (couldPlayIfEnoughData()) | 3478 // Disable potential updating of playback position, as that will |
| 3463 return true; | 3479 // require v8 allocations; not allowed while GCing |
| 3480 // (hasPendingActivity() is called during a v8 GC.) | |
| 3481 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
| |
| 3482 &m_officialPlaybackPositionNeedsUpdate); | |
| 3483 | |
| 3484 // When playing or if playback may continue, timeupdate events may be fired. | |
| 3485 if (couldPlayIfEnoughData()) | |
| 3486 return true; | |
| 3487 } | |
| 3464 | 3488 |
| 3465 // When the seek finishes timeupdate and seeked events will be fired. | 3489 // When the seek finishes timeupdate and seeked events will be fired. |
| 3466 if (m_seeking) | 3490 if (m_seeking) |
| 3467 return true; | 3491 return true; |
| 3468 | 3492 |
| 3469 // When connected to a MediaSource, e.g. setting MediaSource.duration will | 3493 // When connected to a MediaSource, e.g. setting MediaSource.duration will |
| 3470 // cause a durationchange event to be fired. | 3494 // cause a durationchange event to be fired. |
| 3471 if (m_mediaSource) | 3495 if (m_mediaSource) |
| 3472 return true; | 3496 return true; |
| 3473 | 3497 |
| (...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4192 | 4216 |
| 4193 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() | 4217 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() |
| 4194 const { | 4218 const { |
| 4195 IntRect result; | 4219 IntRect result; |
| 4196 if (LayoutObject* object = m_element->layoutObject()) | 4220 if (LayoutObject* object = m_element->layoutObject()) |
| 4197 result = object->absoluteBoundingBoxRect(); | 4221 result = object->absoluteBoundingBoxRect(); |
| 4198 return result; | 4222 return result; |
| 4199 } | 4223 } |
| 4200 | 4224 |
| 4201 } // namespace blink | 4225 } // namespace blink |
| OLD | NEW |