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 "platform/wtf/Assertions.h" |
8 | 8 |
9 namespace blink { | 9 namespace blink { |
10 | 10 |
11 static unsigned g_plugin_script_forbidden_count = 0; | 11 static unsigned g_plugin_script_forbidden_count = 0; |
12 | 12 |
13 PluginScriptForbiddenScope::PluginScriptForbiddenScope() { | 13 PluginScriptForbiddenScope::PluginScriptForbiddenScope() { |
14 ASSERT(IsMainThread()); | 14 ASSERT(IsMainThread()); |
15 ++g_plugin_script_forbidden_count; | 15 ++g_plugin_script_forbidden_count; |
16 } | 16 } |
17 | 17 |
18 PluginScriptForbiddenScope::~PluginScriptForbiddenScope() { | 18 PluginScriptForbiddenScope::~PluginScriptForbiddenScope() { |
19 ASSERT(IsMainThread()); | 19 ASSERT(IsMainThread()); |
20 ASSERT(g_plugin_script_forbidden_count); | 20 ASSERT(g_plugin_script_forbidden_count); |
21 --g_plugin_script_forbidden_count; | 21 --g_plugin_script_forbidden_count; |
22 } | 22 } |
23 | 23 |
24 bool PluginScriptForbiddenScope::IsForbidden() { | 24 bool PluginScriptForbiddenScope::IsForbidden() { |
25 ASSERT(IsMainThread()); | 25 ASSERT(IsMainThread()); |
26 return g_plugin_script_forbidden_count > 0; | 26 return g_plugin_script_forbidden_count > 0; |
27 } | 27 } |
28 | 28 |
29 } // namespace blink | 29 } // namespace blink |
OLD | NEW |