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

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

Issue 567933002: Simplify test-debug/ProcessDebugMessagesThreaded and add debug output. (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 6f5ca963161cedcfb38516f884c23264a22f3994..0adcc0a2bc53b8a68cfac9d5441c28bd33d56efc 100644
--- a/test/cctest/test-debug.cc
+++ b/test/cctest/test-debug.cc
@@ -6571,6 +6571,10 @@ TEST(ProcessDebugMessages) {
}
+class SendCommandThread;
+static SendCommandThread* send_command_thread_ = NULL;
+
+
class SendCommandThread : public v8::base::Thread {
public:
explicit SendCommandThread(v8::Isolate* isolate)
@@ -6578,24 +6582,11 @@ class SendCommandThread : public v8::base::Thread {
semaphore_(0),
isolate_(isolate) {}
- 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();
+ send_command_thread_->semaphore_.Signal();
}
}
@@ -6610,13 +6601,16 @@ class SendCommandThread : public v8::base::Thread {
int length = AsciiToUtf16(scripts_command, buffer);
// Send scripts command.
- for (int i = 0; i < 100; i++) {
+ for (int i = 0; i < 20; i++) {
+ v8::base::ElapsedTimer timer;
+ timer.Start();
CHECK_EQ(i, counting_message_handler_counter);
// Queue debug message.
- v8::Debug::SendCommand(isolate_, buffer, length,
- new ClientDataImpl(&semaphore_));
+ v8::Debug::SendCommand(isolate_, buffer, length);
// Wait for the message handler to pick up the response.
semaphore_.Wait();
+ i::PrintF("iteration %d took %f ms\n", i,
+ timer.Elapsed().InMillisecondsF());
}
v8::V8::TerminateExecution(isolate_);
@@ -6630,8 +6624,6 @@ class SendCommandThread : public v8::base::Thread {
};
-static SendCommandThread* send_command_thread_ = NULL;
-
static void StartSendingCommands(
const v8::FunctionCallbackInfo<v8::Value>& info) {
send_command_thread_->StartSending();
@@ -6656,7 +6648,7 @@ TEST(ProcessDebugMessagesThreaded) {
CompileRun("start(); while (true) { }");
- CHECK_EQ(100, counting_message_handler_counter);
+ CHECK_EQ(20, counting_message_handler_counter);
v8::Debug::SetMessageHandler(NULL);
CheckDebuggerUnloaded();
« 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