| 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 | 214 |
| 215 script_execution_context_->reportException( | 215 script_execution_context_->reportException( |
| 216 webkit_glue::WebStringToString(error_message), | 216 webkit_glue::WebStringToString(error_message), |
| 217 line_number, | 217 line_number, |
| 218 webkit_glue::WebStringToString(source_url)); | 218 webkit_glue::WebStringToString(source_url)); |
| 219 } | 219 } |
| 220 | 220 |
| 221 void WebWorkerClientImpl::postConsoleMessageToWorkerObject( | 221 void WebWorkerClientImpl::postConsoleMessageToWorkerObject( |
| 222 int destination_id, | 222 int destination_id, |
| 223 int source_id, | 223 int source_id, |
| 224 int message_type, |
| 224 int message_level, | 225 int message_level, |
| 225 const WebString& message, | 226 const WebString& message, |
| 226 int line_number, | 227 int line_number, |
| 227 const WebString& source_url) { | 228 const WebString& source_url) { |
| 228 if (WTF::currentThread() != worker_thread_id_) { | 229 if (WTF::currentThread() != worker_thread_id_) { |
| 229 script_execution_context_->postTask( | 230 script_execution_context_->postTask( |
| 230 WebCore::createCallbackTask(&PostConsoleMessageToWorkerObjectTask, this, | 231 WebCore::createCallbackTask(&PostConsoleMessageToWorkerObjectTask, this, |
| 231 destination_id, source_id, message_level, | 232 destination_id, source_id, message_type, message_level, |
| 232 webkit_glue::WebStringToString(message), | 233 webkit_glue::WebStringToString(message), |
| 233 line_number, | 234 line_number, |
| 234 webkit_glue::WebStringToString(source_url))); | 235 webkit_glue::WebStringToString(source_url))); |
| 235 return; | 236 return; |
| 236 } | 237 } |
| 237 | 238 |
| 238 script_execution_context_->addMessage( | 239 script_execution_context_->addMessage( |
| 239 static_cast<WebCore::MessageDestination>(destination_id), | 240 static_cast<WebCore::MessageDestination>(destination_id), |
| 240 static_cast<WebCore::MessageSource>(source_id), | 241 static_cast<WebCore::MessageSource>(source_id), |
| 242 static_cast<WebCore::MessageType>(message_type), |
| 241 static_cast<WebCore::MessageLevel>(message_level), | 243 static_cast<WebCore::MessageLevel>(message_level), |
| 242 webkit_glue::WebStringToString(message), | 244 webkit_glue::WebStringToString(message), |
| 243 line_number, | 245 line_number, |
| 244 webkit_glue::WebStringToString(source_url)); | 246 webkit_glue::WebStringToString(source_url)); |
| 245 } | 247 } |
| 246 | 248 |
| 247 void WebWorkerClientImpl::confirmMessageFromWorkerObject( | 249 void WebWorkerClientImpl::confirmMessageFromWorkerObject( |
| 248 bool has_pending_activity) { | 250 bool has_pending_activity) { |
| 249 // unconfirmed_message_count_ can only be updated on the thread where it's | 251 // unconfirmed_message_count_ can only be updated on the thread where it's |
| 250 // accessed. Otherwise there are race conditions with v8's garbage | 252 // accessed. Otherwise there are race conditions with v8's garbage |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 const WebCore::String& source_url) { | 327 const WebCore::String& source_url) { |
| 326 this_ptr->script_execution_context_->reportException( | 328 this_ptr->script_execution_context_->reportException( |
| 327 error_message, line_number, source_url); | 329 error_message, line_number, source_url); |
| 328 } | 330 } |
| 329 | 331 |
| 330 void WebWorkerClientImpl::PostConsoleMessageToWorkerObjectTask( | 332 void WebWorkerClientImpl::PostConsoleMessageToWorkerObjectTask( |
| 331 WebCore::ScriptExecutionContext* context, | 333 WebCore::ScriptExecutionContext* context, |
| 332 WebWorkerClientImpl* this_ptr, | 334 WebWorkerClientImpl* this_ptr, |
| 333 int destination_id, | 335 int destination_id, |
| 334 int source_id, | 336 int source_id, |
| 337 int message_type, |
| 335 int message_level, | 338 int message_level, |
| 336 const WebCore::String& message, | 339 const WebCore::String& message, |
| 337 int line_number, | 340 int line_number, |
| 338 const WebCore::String& source_url) { | 341 const WebCore::String& source_url) { |
| 339 this_ptr->script_execution_context_->addMessage( | 342 this_ptr->script_execution_context_->addMessage( |
| 340 static_cast<WebCore::MessageDestination>(destination_id), | 343 static_cast<WebCore::MessageDestination>(destination_id), |
| 341 static_cast<WebCore::MessageSource>(source_id), | 344 static_cast<WebCore::MessageSource>(source_id), |
| 345 static_cast<WebCore::MessageType>(message_type), |
| 342 static_cast<WebCore::MessageLevel>(message_level), | 346 static_cast<WebCore::MessageLevel>(message_level), |
| 343 message, | 347 message, |
| 344 line_number, | 348 line_number, |
| 345 source_url); | 349 source_url); |
| 346 } | 350 } |
| 347 | 351 |
| 348 void WebWorkerClientImpl::ConfirmMessageFromWorkerObjectTask( | 352 void WebWorkerClientImpl::ConfirmMessageFromWorkerObjectTask( |
| 349 WebCore::ScriptExecutionContext* context, | 353 WebCore::ScriptExecutionContext* context, |
| 350 WebWorkerClientImpl* this_ptr) { | 354 WebWorkerClientImpl* this_ptr) { |
| 351 this_ptr->unconfirmed_message_count_--; | 355 this_ptr->unconfirmed_message_count_--; |
| 352 } | 356 } |
| 353 | 357 |
| 354 void WebWorkerClientImpl::ReportPendingActivityTask( | 358 void WebWorkerClientImpl::ReportPendingActivityTask( |
| 355 WebCore::ScriptExecutionContext* context, | 359 WebCore::ScriptExecutionContext* context, |
| 356 WebWorkerClientImpl* this_ptr, | 360 WebWorkerClientImpl* this_ptr, |
| 357 bool has_pending_activity) { | 361 bool has_pending_activity) { |
| 358 this_ptr->worker_context_had_pending_activity_ = has_pending_activity; | 362 this_ptr->worker_context_had_pending_activity_ = has_pending_activity; |
| 359 } | 363 } |
| 360 | 364 |
| 361 #endif | 365 #endif |
| OLD | NEW |