Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1486)

Unified Diff: third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h

Issue 1806643002: Revert of Remove V8RecrusionScope, cleanup call sites. (patchset #8 id:140001 of https://codereview… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reverts 1805543002 Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/public/blink_headers.gypi ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « third_party/WebKit/public/blink_headers.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698