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

Side by Side Diff: test/unittests/test-utils.cc

Issue 1209403005: Let the second pass phantom callbacks run in a separate task on the foreground thread. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Run second pass callbacks synchronously when GC is forced. Created 5 years, 5 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
« no previous file with comments | « test/cctest/test-api.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project 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 "test/unittests/test-utils.h" 5 #include "test/unittests/test-utils.h"
6 6
7 #include "include/libplatform/libplatform.h"
7 #include "src/base/platform/time.h" 8 #include "src/base/platform/time.h"
8 #include "src/debug.h" 9 #include "src/debug.h"
9 #include "src/flags.h" 10 #include "src/flags.h"
10 #include "src/isolate.h" 11 #include "src/isolate.h"
12 #include "src/v8.h"
11 13
12 namespace v8 { 14 namespace v8 {
13 15
14 class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { 16 class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
15 public: 17 public:
16 virtual void* Allocate(size_t length) { 18 virtual void* Allocate(size_t length) {
17 void* data = AllocateUninitialized(length); 19 void* data = AllocateUninitialized(length);
18 return data == NULL ? data : memset(data, 0, length); 20 return data == NULL ? data : memset(data, 0, length);
19 } 21 }
20 virtual void* AllocateUninitialized(size_t length) { return malloc(length); } 22 virtual void* AllocateUninitialized(size_t length) { return malloc(length); }
(...skipping 23 matching lines...) Expand all
44 array_buffer_allocator_ = new ArrayBufferAllocator; 46 array_buffer_allocator_ = new ArrayBufferAllocator;
45 create_params.array_buffer_allocator = array_buffer_allocator_; 47 create_params.array_buffer_allocator = array_buffer_allocator_;
46 isolate_ = v8::Isolate::New(create_params); 48 isolate_ = v8::Isolate::New(create_params);
47 EXPECT_TRUE(isolate_ != NULL); 49 EXPECT_TRUE(isolate_ != NULL);
48 } 50 }
49 51
50 52
51 // static 53 // static
52 void TestWithIsolate::TearDownTestCase() { 54 void TestWithIsolate::TearDownTestCase() {
53 ASSERT_TRUE(isolate_ != NULL); 55 ASSERT_TRUE(isolate_ != NULL);
56 v8::Platform* platform = internal::V8::GetCurrentPlatform();
57 ASSERT_TRUE(platform != NULL);
58 while (platform::PumpMessageLoop(platform, isolate_)) continue;
54 isolate_->Dispose(); 59 isolate_->Dispose();
55 isolate_ = NULL; 60 isolate_ = NULL;
56 delete array_buffer_allocator_; 61 delete array_buffer_allocator_;
57 Test::TearDownTestCase(); 62 Test::TearDownTestCase();
58 } 63 }
59 64
60 65
61 TestWithContext::TestWithContext() 66 TestWithContext::TestWithContext()
62 : context_(Context::New(isolate())), context_scope_(context_) {} 67 : context_(Context::New(isolate())), context_scope_(context_) {}
63 68
(...skipping 30 matching lines...) Expand all
94 99
95 base::RandomNumberGenerator* TestWithIsolate::random_number_generator() const { 100 base::RandomNumberGenerator* TestWithIsolate::random_number_generator() const {
96 return isolate()->random_number_generator(); 101 return isolate()->random_number_generator();
97 } 102 }
98 103
99 104
100 TestWithZone::~TestWithZone() {} 105 TestWithZone::~TestWithZone() {}
101 106
102 } // namespace internal 107 } // namespace internal
103 } // namespace v8 108 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/test-api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698