OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights
reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 audioSourceProvider()->setClient(0); | 362 audioSourceProvider()->setClient(0); |
363 #endif | 363 #endif |
364 document().decrementLoadEventDelayCount(); | 364 document().decrementLoadEventDelayCount(); |
365 } | 365 } |
366 | 366 |
367 void HTMLMediaElement::didMoveToNewDocument(Document* oldDocument) | 367 void HTMLMediaElement::didMoveToNewDocument(Document* oldDocument) |
368 { | 368 { |
369 LOG(Media, "HTMLMediaElement::didMoveToNewDocument"); | 369 LOG(Media, "HTMLMediaElement::didMoveToNewDocument"); |
370 | 370 |
371 if (m_shouldDelayLoadEvent) { | 371 if (m_shouldDelayLoadEvent) { |
372 if (oldDocument) | |
373 oldDocument->decrementLoadEventDelayCount(); | |
374 document().incrementLoadEventDelayCount(); | 372 document().incrementLoadEventDelayCount(); |
| 373 // Note: Keeping the load event delay count increment on oldDocument tha
t was added |
| 374 // when m_shouldDelayLoadEvent was set so that destruction of m_player c
an not |
| 375 // cause load event dispatching in oldDocument. |
| 376 } else if (oldDocument) { |
| 377 // Incrementing the load event delay count so that destruction of m_play
er can not |
| 378 // cause load event dispatching in oldDocument. |
| 379 oldDocument->incrementLoadEventDelayCount(); |
375 } | 380 } |
376 | 381 |
377 if (oldDocument) | 382 if (oldDocument) |
378 removeElementFromDocumentMap(this, oldDocument); | 383 removeElementFromDocumentMap(this, oldDocument); |
379 | 384 |
380 addElementToDocumentMap(this, &document()); | 385 addElementToDocumentMap(this, &document()); |
381 | 386 |
382 // FIXME: This is a temporary fix to prevent this object from causing the | 387 // FIXME: This is a temporary fix to prevent this object from causing the |
383 // MediaPlayer to dereference Frame and FrameLoader pointers from the | 388 // MediaPlayer to dereference Frame and FrameLoader pointers from the |
384 // previous document. A proper fix would provide a mechanism to allow this | 389 // previous document. A proper fix would provide a mechanism to allow this |
385 // object to refresh the MediaPlayer's Frame and FrameLoader references on | 390 // object to refresh the MediaPlayer's Frame and FrameLoader references on |
386 // document changes so that playback can be resumed properly. | 391 // document changes so that playback can be resumed properly. |
387 userCancelledLoad(); | 392 userCancelledLoad(); |
388 | 393 |
| 394 // Decrement the load event delay count on oldDocument now that m_player has
been destroyed |
| 395 // and there is no risk of dispatching a load event from within the destruct
or. |
| 396 if (oldDocument) |
| 397 oldDocument->decrementLoadEventDelayCount(); |
| 398 |
389 HTMLElement::didMoveToNewDocument(oldDocument); | 399 HTMLElement::didMoveToNewDocument(oldDocument); |
390 } | 400 } |
391 | 401 |
392 bool HTMLMediaElement::hasCustomFocusLogic() const | 402 bool HTMLMediaElement::hasCustomFocusLogic() const |
393 { | 403 { |
394 return true; | 404 return true; |
395 } | 405 } |
396 | 406 |
397 bool HTMLMediaElement::supportsFocus() const | 407 bool HTMLMediaElement::supportsFocus() const |
398 { | 408 { |
(...skipping 3575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3974 { | 3984 { |
3975 m_restrictions = NoRestrictions; | 3985 m_restrictions = NoRestrictions; |
3976 } | 3986 } |
3977 | 3987 |
3978 void HTMLMediaElement::mediaPlayerScheduleLayerUpdate() | 3988 void HTMLMediaElement::mediaPlayerScheduleLayerUpdate() |
3979 { | 3989 { |
3980 scheduleLayerUpdate(); | 3990 scheduleLayerUpdate(); |
3981 } | 3991 } |
3982 | 3992 |
3983 } | 3993 } |
OLD | NEW |