Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 79 void disableEval(const String&); | 79 void disableEval(const String&); |
| 80 | 80 |
| 81 // Used by Inspector agents: | 81 // Used by Inspector agents: |
| 82 ScriptState* scriptState() { return m_scriptState.get(); } | 82 ScriptState* scriptState() { return m_scriptState.get(); } |
| 83 | 83 |
| 84 // Used by V8 bindings: | 84 // Used by V8 bindings: |
| 85 v8::Local<v8::Context> context() { return m_scriptState ? m_scriptState->con text() : v8::Local<v8::Context>(); } | 85 v8::Local<v8::Context> context() { return m_scriptState ? m_scriptState->con text() : v8::Local<v8::Context>(); } |
| 86 | 86 |
| 87 RejectedPromises* rejectedPromises() const { return m_rejectedPromises.get() ; } | 87 RejectedPromises* rejectedPromises() const { return m_rejectedPromises.get() ; } |
| 88 | 88 |
| 89 bool isContextInitialized() { return m_scriptState && !!m_scriptState->perCo ntextData(); } | |
|
kinuko (google)
2015/08/17 10:27:20
nit: this could probably be a const method
annekao
2015/08/17 19:47:41
Done.
| |
| 90 | |
| 89 private: | 91 private: |
| 90 class WorkerGlobalScopeExecutionState; | 92 class WorkerGlobalScopeExecutionState; |
| 91 | 93 |
| 92 bool isContextInitialized() { return m_scriptState && !!m_scriptState->perCo ntextData(); } | |
| 93 v8::Isolate* isolate() const; | 94 v8::Isolate* isolate() const; |
| 94 | 95 |
| 95 // Evaluate a script file in the current execution environment. | 96 // Evaluate a script file in the current execution environment. |
| 96 ScriptValue evaluate(const String& script, const String& fileName, const Tex tPosition& scriptStartPosition, CachedMetadataHandler*, V8CacheOptions); | 97 ScriptValue evaluate(const String& script, const String& fileName, const Tex tPosition& scriptStartPosition, CachedMetadataHandler*, V8CacheOptions); |
| 97 | 98 |
| 98 WorkerGlobalScope& m_workerGlobalScope; | 99 WorkerGlobalScope& m_workerGlobalScope; |
| 99 RefPtr<ScriptState> m_scriptState; | 100 RefPtr<ScriptState> m_scriptState; |
| 100 RefPtr<DOMWrapperWorld> m_world; | 101 RefPtr<DOMWrapperWorld> m_world; |
| 101 String m_disableEvalPending; | 102 String m_disableEvalPending; |
| 102 bool m_executionForbidden; | 103 bool m_executionForbidden; |
| 103 bool m_executionScheduledToTerminate; | 104 bool m_executionScheduledToTerminate; |
| 104 mutable Mutex m_scheduledTerminationMutex; | 105 mutable Mutex m_scheduledTerminationMutex; |
| 105 | 106 |
| 106 OwnPtrWillBePersistent<RejectedPromises> m_rejectedPromises; | 107 OwnPtrWillBePersistent<RejectedPromises> m_rejectedPromises; |
| 107 | 108 |
| 108 // |m_globalScopeExecutionState| refers to a stack object | 109 // |m_globalScopeExecutionState| refers to a stack object |
| 109 // that evaluate() allocates; evaluate() ensuring that the | 110 // that evaluate() allocates; evaluate() ensuring that the |
| 110 // pointer reference to it is removed upon returning. Hence | 111 // pointer reference to it is removed upon returning. Hence |
| 111 // kept as a bare pointer here, and not a Persistent with | 112 // kept as a bare pointer here, and not a Persistent with |
| 112 // Oilpan enabled; stack scanning will visit the object and | 113 // Oilpan enabled; stack scanning will visit the object and |
| 113 // trace its on-heap fields. | 114 // trace its on-heap fields. |
| 114 GC_PLUGIN_IGNORE("394615") | 115 GC_PLUGIN_IGNORE("394615") |
| 115 WorkerGlobalScopeExecutionState* m_globalScopeExecutionState; | 116 WorkerGlobalScopeExecutionState* m_globalScopeExecutionState; |
| 116 }; | 117 }; |
| 117 | 118 |
| 118 } // namespace blink | 119 } // namespace blink |
| 119 | 120 |
| 120 #endif // WorkerScriptController_h | 121 #endif // WorkerScriptController_h |
| OLD | NEW |