Revision: 23810
Author: [email protected]
Date: Tue Sep 9 14:31:49 2014 UTC
Log: Do not force interrupt in test-debug/ProcessDebugMessagesThreaded.
[email protected]
Review URL: https://codereview.chromium.org/557773002
https://code.google.com/p/v8/source/detail?r=23810
Modified:
/branches/bleeding_edge/test/cctest/test-debug.cc
=======================================
--- /branches/bleeding_edge/test/cctest/test-debug.cc Tue Sep 2 07:07:52
2014 UTC
+++ /branches/bleeding_edge/test/cctest/test-debug.cc Tue Sep 9 14:31:49
2014 UTC
@@ -6531,9 +6531,25 @@
semaphore_(0),
isolate_(isolate) {}
- static void ProcessDebugMessages(v8::Isolate* isolate, void* data) {
- v8::Debug::ProcessDebugMessages();
- reinterpret_cast<v8::base::Semaphore*>(data)->Signal();
+ class ClientDataImpl : public v8::Debug::ClientData {
+ public:
+ explicit ClientDataImpl(v8::base::Semaphore* semaphore)
+ : semaphore_(semaphore) {}
+ v8::base::Semaphore* semaphore() { return semaphore_; }
+
+ private:
+ v8::base::Semaphore* semaphore_;
+ };
+
+ static void CountingAndSignallingMessageHandler(
+ const v8::Debug::Message& message) {
+ if (message.IsResponse()) {
+ counting_message_handler_counter++;
+ ClientDataImpl* data =
+ reinterpret_cast<ClientDataImpl*>(message.GetClientData());
+ v8::base::Semaphore* semaphore = data->semaphore();
+ semaphore->Signal();
+ }
}
virtual void Run() {
@@ -6550,18 +6566,16 @@
for (int i = 0; i < 100; i++) {
CHECK_EQ(i, counting_message_handler_counter);
// Queue debug message.
- v8::Debug::SendCommand(isolate_, buffer, length);
- // Synchronize with the main thread to force message processing.
- isolate_->RequestInterrupt(ProcessDebugMessages, &semaphore_);
+ v8::Debug::SendCommand(isolate_, buffer, length,
+ new ClientDataImpl(&semaphore_));
+ // Wait for the message handler to pick up the response.
semaphore_.Wait();
}
v8::V8::TerminateExecution(isolate_);
}
- void StartSending() {
- semaphore_.Signal();
- }
+ void StartSending() { semaphore_.Signal(); }
private:
v8::base::Semaphore semaphore_;
@@ -6584,7 +6598,8 @@
counting_message_handler_counter = 0;
- v8::Debug::SetMessageHandler(CountingMessageHandler);
+ v8::Debug::SetMessageHandler(
+ SendCommandThread::CountingAndSignallingMessageHandler);
send_command_thread_ = new SendCommandThread(isolate);
send_command_thread_->Start();
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.