| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 122 |
| 123 ~DetachScope() | 123 ~DetachScope() |
| 124 { | 124 { |
| 125 m_documentLifecycle.decrementDetachCount(); | 125 m_documentLifecycle.decrementDetachCount(); |
| 126 } | 126 } |
| 127 | 127 |
| 128 private: | 128 private: |
| 129 DocumentLifecycle& m_documentLifecycle; | 129 DocumentLifecycle& m_documentLifecycle; |
| 130 }; | 130 }; |
| 131 | 131 |
| 132 // Throttling is disabled by default. Instantiating this class allows |
| 133 // throttling (e.g., during BeginMainFrame). If a script needs to run inside |
| 134 // this scope, DisallowThrottlingScope should be used to let the script |
| 135 // perform a synchronous layout if necessary. |
| 132 class CORE_EXPORT AllowThrottlingScope { | 136 class CORE_EXPORT AllowThrottlingScope { |
| 133 STACK_ALLOCATED(); | 137 STACK_ALLOCATED(); |
| 134 WTF_MAKE_NONCOPYABLE(AllowThrottlingScope); | 138 WTF_MAKE_NONCOPYABLE(AllowThrottlingScope); |
| 135 public: | 139 public: |
| 136 AllowThrottlingScope(DocumentLifecycle&); | 140 AllowThrottlingScope(DocumentLifecycle&); |
| 137 ~AllowThrottlingScope(); | 141 ~AllowThrottlingScope(); |
| 138 }; | 142 }; |
| 139 | 143 |
| 144 class CORE_EXPORT DisallowThrottlingScope { |
| 145 STACK_ALLOCATED(); |
| 146 WTF_MAKE_NONCOPYABLE(DisallowThrottlingScope); |
| 147 |
| 148 public: |
| 149 DisallowThrottlingScope(DocumentLifecycle&); |
| 150 ~DisallowThrottlingScope(); |
| 151 |
| 152 private: |
| 153 int m_savedCount; |
| 154 }; |
| 155 |
| 140 DocumentLifecycle(); | 156 DocumentLifecycle(); |
| 141 ~DocumentLifecycle(); | 157 ~DocumentLifecycle(); |
| 142 | 158 |
| 143 bool isActive() const { return m_state > Inactive && m_state < Stopping; } | 159 bool isActive() const { return m_state > Inactive && m_state < Stopping; } |
| 144 LifecycleState state() const { return m_state; } | 160 LifecycleState state() const { return m_state; } |
| 145 | 161 |
| 146 bool stateAllowsTreeMutations() const; | 162 bool stateAllowsTreeMutations() const; |
| 147 bool stateAllowsLayoutTreeMutations() const; | 163 bool stateAllowsLayoutTreeMutations() const; |
| 148 bool stateAllowsDetach() const; | 164 bool stateAllowsDetach() const; |
| 149 bool stateAllowsLayoutInvalidation() const; | 165 bool stateAllowsLayoutInvalidation() const; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 return m_state != InPerformLayout | 231 return m_state != InPerformLayout |
| 216 && m_state != InCompositingUpdate | 232 && m_state != InCompositingUpdate |
| 217 && m_state != InPaintInvalidation | 233 && m_state != InPaintInvalidation |
| 218 && m_state != InUpdatePaintProperties | 234 && m_state != InUpdatePaintProperties |
| 219 && m_state != InPaint; | 235 && m_state != InPaint; |
| 220 } | 236 } |
| 221 | 237 |
| 222 } // namespace blink | 238 } // namespace blink |
| 223 | 239 |
| 224 #endif | 240 #endif |
| OLD | NEW |