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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/GlobalScopeScriptController.h

Issue 1535943005: Initial implementation of bindings and basic classes for worklets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix memory leak. Created 5 years 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
Index: third_party/WebKit/Source/bindings/core/v8/GlobalScopeScriptController.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/WorkerScriptController.h b/third_party/WebKit/Source/bindings/core/v8/GlobalScopeScriptController.h
similarity index 83%
copy from third_party/WebKit/Source/bindings/core/v8/WorkerScriptController.h
copy to third_party/WebKit/Source/bindings/core/v8/GlobalScopeScriptController.h
index 8213766fb9fa0e007989d39bd31dfdccdc60292d..a41475a4402c9075d56b0bab587ffaf1130b86ab 100644
--- a/third_party/WebKit/Source/bindings/core/v8/WorkerScriptController.h
+++ b/third_party/WebKit/Source/bindings/core/v8/GlobalScopeScriptController.h
@@ -28,8 +28,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WorkerScriptController_h
-#define WorkerScriptController_h
+#ifndef GlobalScopeScriptController_h
+#define GlobalScopeScriptController_h
#include "bindings/core/v8/RejectedPromises.h"
#include "bindings/core/v8/ScriptValue.h"
@@ -44,18 +44,15 @@
namespace blink {
+class AbstractGlobalScope;
class CachedMetadataHandler;
class ErrorEvent;
class ExceptionState;
class ScriptSourceCode;
-class WorkerGlobalScope;
-class CORE_EXPORT WorkerScriptController : public NoBaseWillBeGarbageCollectedFinalized<WorkerScriptController> {
- USING_FAST_MALLOC_WILL_BE_REMOVED(WorkerScriptController);
- WTF_MAKE_NONCOPYABLE(WorkerScriptController);
+class CORE_EXPORT GlobalScopeScriptController : public NoBaseWillBeGarbageCollectedFinalized<GlobalScopeScriptController> {
public:
- static PassOwnPtrWillBeRawPtr<WorkerScriptController> create(WorkerGlobalScope*, v8::Isolate*);
- virtual ~WorkerScriptController();
+ virtual ~GlobalScopeScriptController();
void dispose();
bool isExecutionForbidden() const;
@@ -72,7 +69,7 @@ public:
bool initializeContextIfNeeded();
// Async request to terminate future JavaScript execution on the
// worker thread. JavaScript evaluation exits with a
- // non-continuable exception and WorkerScriptController calls
+ // non-continuable exception and GlobalScopeScriptController calls
// forbidExecution to prevent further JavaScript execution. Use
// forbidExecution()/isExecutionForbidden() to guard against
// reentry into JavaScript.
@@ -90,20 +87,25 @@ public:
RejectedPromises* rejectedPromises() const { return m_rejectedPromises.get(); }
- DECLARE_TRACE();
+ DECLARE_VIRTUAL_TRACE();
bool isContextInitialized() const { return m_scriptState && !!m_scriptState->perContextData(); }
+ virtual const WrapperTypeInfo* wrapperTypeInfoForGlobalScope() const = 0;
+ virtual v8::Local<v8::Object> associateGlobalScopeWithWrapper(v8::Isolate*, const WrapperTypeInfo*, v8::Local<v8::Object> wrapper) = 0;
+
+protected:
+ GlobalScopeScriptController(AbstractGlobalScope*, v8::Isolate*);
+
private:
- WorkerScriptController(WorkerGlobalScope*, v8::Isolate*);
- class WorkerGlobalScopeExecutionState;
+ class GlobalScopeExecutionState;
v8::Isolate* isolate() const;
// Evaluate a script file in the current execution environment.
ScriptValue evaluate(const String& script, const String& fileName, const TextPosition& scriptStartPosition, CachedMetadataHandler*, V8CacheOptions);
- RawPtrWillBeMember<WorkerGlobalScope> m_workerGlobalScope;
+ RawPtrWillBeMember<AbstractGlobalScope> m_abstractGlobalScope;
RefPtr<ScriptState> m_scriptState;
RefPtr<DOMWrapperWorld> m_world;
String m_disableEvalPending;
@@ -120,9 +122,9 @@ private:
// Oilpan enabled; stack scanning will visit the object and
// trace its on-heap fields.
GC_PLUGIN_IGNORE("394615")
- WorkerGlobalScopeExecutionState* m_globalScopeExecutionState;
+ GlobalScopeExecutionState* m_globalScopeExecutionState;
kinuko 2015/12/22 08:39:03 nit: given that this is an inner class the class n
ikilpatrick 2015/12/22 23:40:23 Renamed to just ExecutionState which seems ok?
};
} // namespace blink
-#endif // WorkerScriptController_h
+#endif // GlobalScopeScriptController_h

Powered by Google App Engine
This is Rietveld 408576698