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

Side by Side Diff: Source/bindings/v8/WorkerScriptController.h

Issue 180773003: Simplify the way to initialize context (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/bindings/v8/V8WindowShell.cpp ('k') | Source/bindings/v8/WorkerScriptController.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 bool isExecutionForbidden() const; 92 bool isExecutionForbidden() const;
93 93
94 void disableEval(const String&); 94 void disableEval(const String&);
95 95
96 // Returns WorkerScriptController for the currently executing context. 0 will be returned if the current executing context is not the worker context. 96 // Returns WorkerScriptController for the currently executing context. 0 will be returned if the current executing context is not the worker context.
97 static WorkerScriptController* controllerForContext(v8::Isolate*); 97 static WorkerScriptController* controllerForContext(v8::Isolate*);
98 98
99 // Evaluate a script file in the current execution environment. 99 // Evaluate a script file in the current execution environment.
100 ScriptValue evaluate(const String& script, const String& fileName, const TextPosition& scriptStartPosition, WorkerGlobalScopeExecutionState*); 100 ScriptValue evaluate(const String& script, const String& fileName, const TextPosition& scriptStartPosition, WorkerGlobalScopeExecutionState*);
101 101
102 // Returns a local handle of the context. 102 v8::Local<v8::Context> context() { return m_perContextData ? m_perContex tData->context() : v8::Local<v8::Context>(); }
103 v8::Local<v8::Context> context() { return m_contextHolder ? m_contextHol der->context() : v8::Local<v8::Context>(); }
104 103
105 // Send a notification about current thread is going to be idle. 104 // Send a notification about current thread is going to be idle.
106 // Returns true if the embedder should stop calling idleNotification 105 // Returns true if the embedder should stop calling idleNotification
107 // until real work has been done. 106 // until real work has been done.
108 bool idleNotification() { return v8::V8::IdleNotification(); } 107 bool idleNotification() { return v8::V8::IdleNotification(); }
109 108
110 v8::Isolate* isolate() const { return m_isolateHolder->isolate(); } 109 v8::Isolate* isolate() const { return m_isolateHolder->isolate(); }
111 110
112 private: 111 private:
113 bool initializeContextIfNeeded(); 112 bool initializeContextIfNeeded();
114 void disposeContext(); 113 void disposeContext();
115 114
116 WorkerGlobalScope& m_workerGlobalScope; 115 WorkerGlobalScope& m_workerGlobalScope;
117 OwnPtr<gin::IsolateHolder> m_isolateHolder; 116 OwnPtr<gin::IsolateHolder> m_isolateHolder;
118 OwnPtr<gin::ContextHolder> m_contextHolder;
119 OwnPtr<V8PerContextData> m_perContextData; 117 OwnPtr<V8PerContextData> m_perContextData;
120 String m_disableEvalPending; 118 String m_disableEvalPending;
121 RefPtr<DOMWrapperWorld> m_world; 119 RefPtr<DOMWrapperWorld> m_world;
122 bool m_executionForbidden; 120 bool m_executionForbidden;
123 bool m_executionScheduledToTerminate; 121 bool m_executionScheduledToTerminate;
124 mutable Mutex m_scheduledTerminationMutex; 122 mutable Mutex m_scheduledTerminationMutex;
125 RefPtr<ErrorEvent> m_errorEventFromImportedScript; 123 RefPtr<ErrorEvent> m_errorEventFromImportedScript;
126 OwnPtr<V8IsolateInterruptor> m_interruptor; 124 OwnPtr<V8IsolateInterruptor> m_interruptor;
127 }; 125 };
128 126
129 } // namespace WebCore 127 } // namespace WebCore
130 128
131 #endif // WorkerScriptController_h 129 #endif // WorkerScriptController_h
OLDNEW
« no previous file with comments | « Source/bindings/v8/V8WindowShell.cpp ('k') | Source/bindings/v8/WorkerScriptController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698