| Index: third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h
|
| diff --git a/third_party/WebKit/public/web/WebScopedUserGesture.h b/third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h
|
| similarity index 54%
|
| copy from third_party/WebKit/public/web/WebScopedUserGesture.h
|
| copy to third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h
|
| index a4e3903f3f4dc20439ba672f8492318d829aa197..dd96fc6c003c0e85dd242f479d337f1e95810e75 100644
|
| --- a/third_party/WebKit/public/web/WebScopedUserGesture.h
|
| +++ b/third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h
|
| @@ -1,5 +1,5 @@
|
| /*
|
| - * Copyright (C) 2011 Google Inc. All rights reserved.
|
| + * Copyright (C) 2012 Google Inc. All rights reserved.
|
| *
|
| * Redistribution and use in source and binary forms, with or without
|
| * modification, are permitted provided that the following conditions are
|
| @@ -28,43 +28,49 @@
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| */
|
|
|
| -#ifndef WebScopedUserGesture_h
|
| -#define WebScopedUserGesture_h
|
| +#ifndef WebScopedMicrotaskSuppression_h
|
| +#define WebScopedMicrotaskSuppression_h
|
|
|
| #include "../platform/WebPrivateOwnPtr.h"
|
|
|
| namespace blink {
|
|
|
| -class UserGestureIndicator;
|
| -class WebUserGestureToken;
|
| -
|
| -// An instance of this class, while kept alive, will indicate that we are in
|
| -// the context of a known user gesture. To use, create one, perform whatever
|
| -// actions were done under color of a known user gesture, and then delete it.
|
| -// Usually this will be done on the stack.
|
| +// This class wraps V8RecursionScope::BypassMicrotaskCheckpoint. Please
|
| +// see V8RecursionScope.h for full usage. Short story: Embedder calls into
|
| +// script contexts which also host page script must do one of two things:
|
| +//
|
| +// 1. If the call may cause any page/author script to run, it must be
|
| +// captured for pre/post work (e.g. inspector instrumentation/microtask
|
| +// delivery) and thus be invoked through WebFrame (e.g. executeScript*,
|
| +// callFunction*).
|
| +// 2. If the call will not cause any page/author script to run, the call
|
| +// should be made directly via the v8 context, but the callsite must be
|
| +// accompanied by a stack allocated WebScopedMicrotaskSuppression, e.g.:
|
| +//
|
| +// ...
|
| +// {
|
| +// blink::WebScopedMicrotaskSuppression suppression;
|
| +// func->Call(global, argv, args);
|
| +// }
|
| +// ...
|
| //
|
| -// SECURITY WARNING: Do not create several instances of this class for the same
|
| -// user gesture. Doing so might enable malicious code to work around certain
|
| -// restrictions such as opening multiple windows.
|
| -// Instead, obtain the current WebUserGestureToken from the
|
| -// WebUserGestureIndicator, and use this token to create a
|
| -// WebScopedUserGesture. If the token was alrady consumed, the new
|
| -// WebScopedUserGesture will not indicate that we are in the context of a user
|
| -// gesture.
|
| -class WebScopedUserGesture {
|
| +class WebScopedMicrotaskSuppression {
|
| public:
|
| - explicit WebScopedUserGesture(const WebUserGestureToken& token) { initializeWithToken(token); }
|
| - WebScopedUserGesture() { initialize(); }
|
| - ~WebScopedUserGesture() { reset(); }
|
| + WebScopedMicrotaskSuppression() { initialize(); }
|
| + ~WebScopedMicrotaskSuppression() { reset(); }
|
|
|
| private:
|
| BLINK_EXPORT void initialize();
|
| - BLINK_EXPORT void initializeWithToken(const WebUserGestureToken&);
|
| BLINK_EXPORT void reset();
|
|
|
| - WebPrivateOwnPtr<UserGestureIndicator> m_indicator;
|
| + // Always declare this data member. When assertions are on in
|
| + // Release builds of Blink, this header may be included from
|
| + // Chromium with different preprocessor options than used when
|
| + // building Blink itself.
|
| + class Impl;
|
| + WebPrivateOwnPtr<Impl> m_impl;
|
| };
|
|
|
| } // namespace blink
|
|
|
| -#endif // WebScopedUserGesture_h
|
| +#endif
|
|
|