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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 bool hadException; | 56 bool hadException; |
57 String errorMessage; | 57 String errorMessage; |
58 int lineNumber; | 58 int lineNumber; |
59 int columnNumber; | 59 int columnNumber; |
60 String sourceURL; | 60 String sourceURL; |
61 ScriptValue exception; | 61 ScriptValue exception; |
62 }; | 62 }; |
63 | 63 |
64 class WorkerScriptController { | 64 class WorkerScriptController { |
65 public: | 65 public: |
66 WorkerScriptController(WorkerGlobalScope*); | 66 explicit WorkerScriptController(WorkerGlobalScope&); |
67 ~WorkerScriptController(); | 67 ~WorkerScriptController(); |
68 | 68 |
69 WorkerGlobalScope* workerGlobalScope() { return m_workerGlobalScope; } | 69 WorkerGlobalScope& workerGlobalScope() { return m_workerGlobalScope; } |
70 | 70 |
71 void evaluate(const ScriptSourceCode&, RefPtr<ErrorEvent>* = 0); | 71 void evaluate(const ScriptSourceCode&, RefPtr<ErrorEvent>* = 0); |
72 | 72 |
73 void rethrowExceptionFromImportedScript(PassRefPtr<ErrorEvent>); | 73 void rethrowExceptionFromImportedScript(PassRefPtr<ErrorEvent>); |
74 | 74 |
75 // Async request to terminate a future JS execution. Eventually causes t
ermination | 75 // Async request to terminate a future JS execution. Eventually causes t
ermination |
76 // exception raised during JS execution, if the worker thread happens to
run JS. | 76 // exception raised during JS execution, if the worker thread happens to
run JS. |
77 // After JS execution was terminated in this way, the Worker thread has
to use | 77 // After JS execution was terminated in this way, the Worker thread has
to use |
78 // forbidExecution()/isExecutionForbidden() to guard against reentry int
o JS. | 78 // forbidExecution()/isExecutionForbidden() to guard against reentry int
o JS. |
79 // Can be called from any thread. | 79 // Can be called from any thread. |
(...skipping 20 matching lines...) Expand all Loading... |
100 // Returns true if the embedder should stop calling idleNotification | 100 // Returns true if the embedder should stop calling idleNotification |
101 // until real work has been done. | 101 // until real work has been done. |
102 bool idleNotification() { return v8::V8::IdleNotification(); } | 102 bool idleNotification() { return v8::V8::IdleNotification(); } |
103 | 103 |
104 v8::Isolate* isolate() const { return m_isolate; } | 104 v8::Isolate* isolate() const { return m_isolate; } |
105 | 105 |
106 private: | 106 private: |
107 bool initializeContextIfNeeded(); | 107 bool initializeContextIfNeeded(); |
108 void disposeContext(); | 108 void disposeContext(); |
109 | 109 |
110 WorkerGlobalScope* m_workerGlobalScope; | 110 WorkerGlobalScope& m_workerGlobalScope; |
111 v8::Isolate* m_isolate; | 111 v8::Isolate* m_isolate; |
112 ScopedPersistent<v8::Context> m_context; | 112 ScopedPersistent<v8::Context> m_context; |
113 OwnPtr<V8PerContextData> m_perContextData; | 113 OwnPtr<V8PerContextData> m_perContextData; |
114 String m_disableEvalPending; | 114 String m_disableEvalPending; |
115 OwnPtr<DOMDataStore> m_domDataStore; | 115 OwnPtr<DOMDataStore> m_domDataStore; |
116 bool m_executionForbidden; | 116 bool m_executionForbidden; |
117 bool m_executionScheduledToTerminate; | 117 bool m_executionScheduledToTerminate; |
118 mutable Mutex m_scheduledTerminationMutex; | 118 mutable Mutex m_scheduledTerminationMutex; |
119 RefPtr<ErrorEvent> m_errorEventFromImportedScript; | 119 RefPtr<ErrorEvent> m_errorEventFromImportedScript; |
120 }; | 120 }; |
121 | 121 |
122 } // namespace WebCore | 122 } // namespace WebCore |
123 | 123 |
124 #endif // WorkerScriptController_h | 124 #endif // WorkerScriptController_h |
OLD | NEW |