OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. |
3 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2011, 2012 Google Inc. All rights 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 return true; | 62 return true; |
63 } | 63 } |
64 | 64 |
65 static bool preferHiddenVolumeControls(const Document& document) | 65 static bool preferHiddenVolumeControls(const Document& document) |
66 { | 66 { |
67 return !document.settings() || document.settings()->preferHiddenVolumeContro
ls(); | 67 return !document.settings() || document.settings()->preferHiddenVolumeContro
ls(); |
68 } | 68 } |
69 | 69 |
70 class MediaControls::BatchedControlUpdate { | 70 class MediaControls::BatchedControlUpdate { |
71 WTF_MAKE_NONCOPYABLE(BatchedControlUpdate); | 71 WTF_MAKE_NONCOPYABLE(BatchedControlUpdate); |
| 72 STACK_ALLOCATED(); |
72 public: | 73 public: |
73 BatchedControlUpdate(MediaControls* controls) : m_controls(controls) | 74 explicit BatchedControlUpdate(MediaControls* controls) |
| 75 : m_controls(controls) |
74 { | 76 { |
75 ASSERT(isMainThread()); | 77 ASSERT(isMainThread()); |
76 ASSERT(s_batchDepth >= 0); | 78 ASSERT(s_batchDepth >= 0); |
77 ++s_batchDepth; | 79 ++s_batchDepth; |
78 } | 80 } |
79 ~BatchedControlUpdate() | 81 ~BatchedControlUpdate() |
80 { | 82 { |
81 ASSERT(isMainThread()); | 83 ASSERT(isMainThread()); |
82 ASSERT(s_batchDepth > 0); | 84 ASSERT(s_batchDepth > 0); |
83 if (!(--s_batchDepth)) | 85 if (!(--s_batchDepth)) |
84 m_controls->computeWhichControlsFit(); | 86 m_controls->computeWhichControlsFit(); |
85 } | 87 } |
86 | 88 |
87 private: | 89 private: |
88 MediaControls* m_controls; | 90 RawPtrWillBeMember<MediaControls> m_controls; |
89 static int s_batchDepth; | 91 static int s_batchDepth; |
90 }; | 92 }; |
91 | 93 |
92 // Count of number open batches for controls visibility. | 94 // Count of number open batches for controls visibility. |
93 int MediaControls::BatchedControlUpdate::s_batchDepth = 0; | 95 int MediaControls::BatchedControlUpdate::s_batchDepth = 0; |
94 | 96 |
95 MediaControls::MediaControls(HTMLMediaElement& mediaElement) | 97 MediaControls::MediaControls(HTMLMediaElement& mediaElement) |
96 : HTMLDivElement(mediaElement.document()) | 98 : HTMLDivElement(mediaElement.document()) |
97 , m_mediaElement(&mediaElement) | 99 , m_mediaElement(&mediaElement) |
98 , m_overlayEnclosure(nullptr) | 100 , m_overlayEnclosure(nullptr) |
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 visitor->trace(m_toggleClosedCaptionsButton); | 749 visitor->trace(m_toggleClosedCaptionsButton); |
748 visitor->trace(m_fullScreenButton); | 750 visitor->trace(m_fullScreenButton); |
749 visitor->trace(m_durationDisplay); | 751 visitor->trace(m_durationDisplay); |
750 visitor->trace(m_enclosure); | 752 visitor->trace(m_enclosure); |
751 visitor->trace(m_castButton); | 753 visitor->trace(m_castButton); |
752 visitor->trace(m_overlayCastButton); | 754 visitor->trace(m_overlayCastButton); |
753 HTMLDivElement::trace(visitor); | 755 HTMLDivElement::trace(visitor); |
754 } | 756 } |
755 | 757 |
756 } | 758 } |
OLD | NEW |