Chromium Code Reviews| Index: Source/platform/PluginScriptForbiddenScope.cpp |
| diff --git a/Source/platform/PluginScriptForbiddenScope.cpp b/Source/platform/PluginScriptForbiddenScope.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3c6bdf4ffaf59744bd4897491d68c4ce715dddd0 |
| --- /dev/null |
| +++ b/Source/platform/PluginScriptForbiddenScope.cpp |
| @@ -0,0 +1,34 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "config.h" |
| +#include "platform/PluginScriptForbiddenScope.h" |
| + |
| +#include "wtf/Assertions.h" |
| +#include "wtf/MainThread.h" |
| + |
| +namespace blink { |
| + |
| +static unsigned s_reentrantScriptForbiddenCount = 0; |
| + |
| +PluginScriptForbiddenScope::PluginScriptForbiddenScope() |
| +{ |
| + ASSERT(isMainThread()); |
| + ++s_reentrantScriptForbiddenCount; |
|
haraken
2015/06/10 03:28:38
s_reentrantScriptForbiddenCount => s_pluginScriptF
dcheng
2015/06/10 03:31:48
Done.
|
| +} |
| + |
| +PluginScriptForbiddenScope::~PluginScriptForbiddenScope() |
| +{ |
| + ASSERT(isMainThread()); |
| + ASSERT(s_reentrantScriptForbiddenCount); |
| + --s_reentrantScriptForbiddenCount; |
| +} |
| + |
| +bool PluginScriptForbiddenScope::isForbidden() |
| +{ |
| + ASSERT(isMainThread()); |
| + return s_reentrantScriptForbiddenCount > 0; |
| +} |
| + |
| +} // namespace blink |