Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(688)

Unified Diff: test/cctest/test-debug.cc

Issue 557773002: Do not force interrupt in test-debug/ProcessDebugMessagesThreaded. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-debug.cc
diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc
index 048de0b1c2c3ca2f9c8e917722bfe411bcf1a372..0cdd23e6fbc8d42686813f514fb7d2b2dca38166 100644
--- a/test/cctest/test-debug.cc
+++ b/test/cctest/test-debug.cc
@@ -6531,9 +6531,25 @@ class SendCommandThread : public v8::base::Thread {
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 @@ class SendCommandThread : public v8::base::Thread {
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 @@ TEST(ProcessDebugMessagesThreaded) {
counting_message_handler_counter = 0;
- v8::Debug::SetMessageHandler(CountingMessageHandler);
+ v8::Debug::SetMessageHandler(
+ SendCommandThread::CountingAndSignallingMessageHandler);
send_command_thread_ = new SendCommandThread(isolate);
send_command_thread_->Start();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698