| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #if ENABLE(WORKERS) | 7 #if ENABLE(WORKERS) |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 | 10 |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 const WebString& source_url) { | 205 const WebString& source_url) { |
| 206 if (WTF::currentThread() != worker_thread_id_) { | 206 if (WTF::currentThread() != worker_thread_id_) { |
| 207 script_execution_context_->postTask( | 207 script_execution_context_->postTask( |
| 208 WebCore::createCallbackTask(&PostExceptionToWorkerObjectTask, this, | 208 WebCore::createCallbackTask(&PostExceptionToWorkerObjectTask, this, |
| 209 webkit_glue::WebStringToString(error_message), | 209 webkit_glue::WebStringToString(error_message), |
| 210 line_number, | 210 line_number, |
| 211 webkit_glue::WebStringToString(source_url))); | 211 webkit_glue::WebStringToString(source_url))); |
| 212 return; | 212 return; |
| 213 } | 213 } |
| 214 | 214 |
| 215 script_execution_context_->reportException( | 215 bool handled = false; |
| 216 webkit_glue::WebStringToString(error_message), | 216 if (worker_->onerror()) |
| 217 line_number, | 217 handled = worker_->dispatchScriptErrorEvent( |
| 218 webkit_glue::WebStringToString(source_url)); | 218 webkit_glue::WebStringToString(error_message), |
| 219 webkit_glue::WebStringToString(source_url), |
| 220 line_number); |
| 221 if (!handled) |
| 222 script_execution_context_->reportException( |
| 223 webkit_glue::WebStringToString(error_message), |
| 224 line_number, |
| 225 webkit_glue::WebStringToString(source_url)); |
| 219 } | 226 } |
| 220 | 227 |
| 221 void WebWorkerClientImpl::postConsoleMessageToWorkerObject( | 228 void WebWorkerClientImpl::postConsoleMessageToWorkerObject( |
| 222 int destination_id, | 229 int destination_id, |
| 223 int source_id, | 230 int source_id, |
| 224 int message_type, | 231 int message_type, |
| 225 int message_level, | 232 int message_level, |
| 226 const WebString& message, | 233 const WebString& message, |
| 227 int line_number, | 234 int line_number, |
| 228 const WebString& source_url) { | 235 const WebString& source_url) { |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 this_ptr->worker_->dispatchMessage(message, port.release()); | 325 this_ptr->worker_->dispatchMessage(message, port.release()); |
| 319 } | 326 } |
| 320 } | 327 } |
| 321 | 328 |
| 322 void WebWorkerClientImpl::PostExceptionToWorkerObjectTask( | 329 void WebWorkerClientImpl::PostExceptionToWorkerObjectTask( |
| 323 WebCore::ScriptExecutionContext* context, | 330 WebCore::ScriptExecutionContext* context, |
| 324 WebWorkerClientImpl* this_ptr, | 331 WebWorkerClientImpl* this_ptr, |
| 325 const WebCore::String& error_message, | 332 const WebCore::String& error_message, |
| 326 int line_number, | 333 int line_number, |
| 327 const WebCore::String& source_url) { | 334 const WebCore::String& source_url) { |
| 328 this_ptr->script_execution_context_->reportException( | 335 bool handled = false; |
| 329 error_message, line_number, source_url); | 336 if (this_ptr->worker_ && this_ptr->worker_->onerror()) |
| 337 handled = this_ptr->worker_->dispatchScriptErrorEvent( |
| 338 error_message, source_url, line_number); |
| 339 if (!handled) |
| 340 this_ptr->script_execution_context_->reportException( |
| 341 error_message, line_number, source_url); |
| 330 } | 342 } |
| 331 | 343 |
| 332 void WebWorkerClientImpl::PostConsoleMessageToWorkerObjectTask( | 344 void WebWorkerClientImpl::PostConsoleMessageToWorkerObjectTask( |
| 333 WebCore::ScriptExecutionContext* context, | 345 WebCore::ScriptExecutionContext* context, |
| 334 WebWorkerClientImpl* this_ptr, | 346 WebWorkerClientImpl* this_ptr, |
| 335 int destination_id, | 347 int destination_id, |
| 336 int source_id, | 348 int source_id, |
| 337 int message_type, | 349 int message_type, |
| 338 int message_level, | 350 int message_level, |
| 339 const WebCore::String& message, | 351 const WebCore::String& message, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 356 } | 368 } |
| 357 | 369 |
| 358 void WebWorkerClientImpl::ReportPendingActivityTask( | 370 void WebWorkerClientImpl::ReportPendingActivityTask( |
| 359 WebCore::ScriptExecutionContext* context, | 371 WebCore::ScriptExecutionContext* context, |
| 360 WebWorkerClientImpl* this_ptr, | 372 WebWorkerClientImpl* this_ptr, |
| 361 bool has_pending_activity) { | 373 bool has_pending_activity) { |
| 362 this_ptr->worker_context_had_pending_activity_ = has_pending_activity; | 374 this_ptr->worker_context_had_pending_activity_ = has_pending_activity; |
| 363 } | 375 } |
| 364 | 376 |
| 365 #endif | 377 #endif |
| OLD | NEW |