| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/PluginScriptForbiddenScope.h" | 5 #include "platform/PluginScriptForbiddenScope.h" |
| 6 | 6 |
| 7 #include "wtf/Assertions.h" | 7 #include "wtf/Assertions.h" |
| 8 #include "wtf/MainThread.h" | |
| 9 | 8 |
| 10 namespace blink { | 9 namespace blink { |
| 11 | 10 |
| 12 static unsigned s_pluginScriptForbiddenCount = 0; | 11 static unsigned s_pluginScriptForbiddenCount = 0; |
| 13 | 12 |
| 14 PluginScriptForbiddenScope::PluginScriptForbiddenScope() | 13 PluginScriptForbiddenScope::PluginScriptForbiddenScope() |
| 15 { | 14 { |
| 16 ASSERT(isMainThread()); | 15 ASSERT(isMainThread()); |
| 17 ++s_pluginScriptForbiddenCount; | 16 ++s_pluginScriptForbiddenCount; |
| 18 } | 17 } |
| 19 | 18 |
| 20 PluginScriptForbiddenScope::~PluginScriptForbiddenScope() | 19 PluginScriptForbiddenScope::~PluginScriptForbiddenScope() |
| 21 { | 20 { |
| 22 ASSERT(isMainThread()); | 21 ASSERT(isMainThread()); |
| 23 ASSERT(s_pluginScriptForbiddenCount); | 22 ASSERT(s_pluginScriptForbiddenCount); |
| 24 --s_pluginScriptForbiddenCount; | 23 --s_pluginScriptForbiddenCount; |
| 25 } | 24 } |
| 26 | 25 |
| 27 bool PluginScriptForbiddenScope::isForbidden() | 26 bool PluginScriptForbiddenScope::isForbidden() |
| 28 { | 27 { |
| 29 ASSERT(isMainThread()); | 28 ASSERT(isMainThread()); |
| 30 return s_pluginScriptForbiddenCount > 0; | 29 return s_pluginScriptForbiddenCount > 0; |
| 31 } | 30 } |
| 32 | 31 |
| 33 } // namespace blink | 32 } // namespace blink |
| OLD | NEW |