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

Side by Side Diff: test/cctest/test-lockers.cc

Issue 7003108: "Deiceolate" Thread classes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2007-2011 the V8 project authors. All rights reserved. 1 // Copyright 2007-2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 namespace i = ::i; 57 namespace i = ::i;
58 58
59 59
60 60
61 61
62 // Migrating an isolate 62 // Migrating an isolate
63 class KangarooThread : public v8::internal::Thread { 63 class KangarooThread : public v8::internal::Thread {
64 public: 64 public:
65 KangarooThread(v8::Isolate* isolate, 65 KangarooThread(v8::Isolate* isolate,
66 v8::Handle<v8::Context> context, int value) 66 v8::Handle<v8::Context> context, int value)
67 : Thread(NULL, "KangarooThread"), 67 : Thread("KangarooThread"),
68 isolate_(isolate), context_(context), value_(value) { 68 isolate_(isolate), context_(context), value_(value) {
69 } 69 }
70 70
71 void Run() { 71 void Run() {
72 { 72 {
73 v8::Locker locker(isolate_); 73 v8::Locker locker(isolate_);
74 v8::Isolate::Scope isolate_scope(isolate_); 74 v8::Isolate::Scope isolate_scope(isolate_);
75 CHECK_EQ(isolate_, v8::internal::Isolate::Current()); 75 CHECK_EQ(isolate_, v8::internal::Isolate::Current());
76 v8::HandleScope scope; 76 v8::HandleScope scope;
77 v8::Context::Scope context_scope(context_); 77 v8::Context::Scope context_scope(context_);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 143
144 void Join() { 144 void Join() {
145 semaphore_->Wait(); 145 semaphore_->Wait();
146 } 146 }
147 147
148 virtual void Run() = 0; 148 virtual void Run() = 0;
149 private: 149 private:
150 class ThreadWithSemaphore : public i::Thread { 150 class ThreadWithSemaphore : public i::Thread {
151 public: 151 public:
152 explicit ThreadWithSemaphore(JoinableThread* joinable_thread) 152 explicit ThreadWithSemaphore(JoinableThread* joinable_thread)
153 : Thread(NULL, joinable_thread->name_), 153 : Thread(joinable_thread->name_),
154 joinable_thread_(joinable_thread) { 154 joinable_thread_(joinable_thread) {
155 } 155 }
156 156
157 virtual void Run() { 157 virtual void Run() {
158 joinable_thread_->Run(); 158 joinable_thread_->Run();
159 joinable_thread_->semaphore_->Signal(); 159 joinable_thread_->semaphore_->Signal();
160 } 160 }
161 161
162 private: 162 private:
163 JoinableThread* joinable_thread_; 163 JoinableThread* joinable_thread_;
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 v8::Context::Scope context_scope(context); 620 v8::Context::Scope context_scope(context);
621 v8::Handle<String> source = v8::String::New("1+1"); 621 v8::Handle<String> source = v8::String::New("1+1");
622 v8::Handle<Script> script = v8::Script::Compile(source); 622 v8::Handle<Script> script = v8::Script::Compile(source);
623 v8::Handle<Value> result = script->Run(); 623 v8::Handle<Value> result = script->Run();
624 v8::String::AsciiValue ascii(result); 624 v8::String::AsciiValue ascii(result);
625 context.Dispose(); 625 context.Dispose();
626 } 626 }
627 isolate->Dispose(); 627 isolate->Dispose();
628 } 628 }
629 } 629 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698