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

Side by Side Diff: Source/core/dom/CrossThreadTaskTest.cpp

Issue 1097443004: Oilpan: rename GCState and GCReason values to reflect function only. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 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 | « Source/bindings/core/v8/V8GCController.cpp ('k') | Source/core/frame/ImageBitmapTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium 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 "config.h" 5 #include "config.h"
6 #include "core/dom/CrossThreadTask.h" 6 #include "core/dom/CrossThreadTask.h"
7 7
8 #include "platform/heap/Handle.h" 8 #include "platform/heap/Handle.h"
9 #include <gtest/gtest.h> 9 #include <gtest/gtest.h>
10 10
(...skipping 19 matching lines...) Expand all
30 } 30 }
31 31
32 class CrossThreadTaskTest : public testing::Test { 32 class CrossThreadTaskTest : public testing::Test {
33 protected: 33 protected:
34 void SetUp() override 34 void SetUp() override
35 { 35 {
36 GCObject::s_counter = 0; 36 GCObject::s_counter = 0;
37 } 37 }
38 void TearDown() override 38 void TearDown() override
39 { 39 {
40 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GC WithSweep, Heap::ForcedGCForTesting); 40 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GC WithSweep, Heap::ForcedGC);
41 ASSERT_EQ(0, GCObject::s_counter); 41 ASSERT_EQ(0, GCObject::s_counter);
42 } 42 }
43 }; 43 };
44 44
45 TEST_F(CrossThreadTaskTest, CreateForGarbageCollectedMethod) 45 TEST_F(CrossThreadTaskTest, CreateForGarbageCollectedMethod)
46 { 46 {
47 OwnPtr<ExecutionContextTask> task1 = createCrossThreadTask(&GCObject::run, n ew GCObject, new GCObject); 47 OwnPtr<ExecutionContextTask> task1 = createCrossThreadTask(&GCObject::run, n ew GCObject, new GCObject);
48 OwnPtr<ExecutionContextTask> task2 = createCrossThreadTask(&GCObject::run, R awPtr<GCObject>(new GCObject), RawPtr<GCObject>(new GCObject)); 48 OwnPtr<ExecutionContextTask> task2 = createCrossThreadTask(&GCObject::run, R awPtr<GCObject>(new GCObject), RawPtr<GCObject>(new GCObject));
49 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith Sweep, Heap::ForcedGCForTesting); 49 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith Sweep, Heap::ForcedGC);
50 EXPECT_EQ(4, GCObject::s_counter); 50 EXPECT_EQ(4, GCObject::s_counter);
51 } 51 }
52 52
53 TEST_F(CrossThreadTaskTest, CreateForFunctionWithGarbageCollected) 53 TEST_F(CrossThreadTaskTest, CreateForFunctionWithGarbageCollected)
54 { 54 {
55 OwnPtr<ExecutionContextTask> task1 = createCrossThreadTask(&functionWithGarb ageCollected, new GCObject); 55 OwnPtr<ExecutionContextTask> task1 = createCrossThreadTask(&functionWithGarb ageCollected, new GCObject);
56 OwnPtr<ExecutionContextTask> task2 = createCrossThreadTask(&functionWithGarb ageCollected, RawPtr<GCObject>(new GCObject)); 56 OwnPtr<ExecutionContextTask> task2 = createCrossThreadTask(&functionWithGarb ageCollected, RawPtr<GCObject>(new GCObject));
57 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith Sweep, Heap::ForcedGCForTesting); 57 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith Sweep, Heap::ForcedGC);
58 EXPECT_EQ(2, GCObject::s_counter); 58 EXPECT_EQ(2, GCObject::s_counter);
59 } 59 }
60 60
61 TEST_F(CrossThreadTaskTest, CreateForFunctionWithExecutionContext) 61 TEST_F(CrossThreadTaskTest, CreateForFunctionWithExecutionContext)
62 { 62 {
63 OwnPtr<ExecutionContextTask> task1 = createCrossThreadTask(&functionWithExec utionContext, new GCObject); 63 OwnPtr<ExecutionContextTask> task1 = createCrossThreadTask(&functionWithExec utionContext, new GCObject);
64 OwnPtr<ExecutionContextTask> task2 = createCrossThreadTask(&functionWithExec utionContext, RawPtr<GCObject>(new GCObject)); 64 OwnPtr<ExecutionContextTask> task2 = createCrossThreadTask(&functionWithExec utionContext, RawPtr<GCObject>(new GCObject));
65 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith Sweep, Heap::ForcedGCForTesting); 65 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith Sweep, Heap::ForcedGC);
66 EXPECT_EQ(2, GCObject::s_counter); 66 EXPECT_EQ(2, GCObject::s_counter);
67 } 67 }
68 68
69 } 69 }
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/V8GCController.cpp ('k') | Source/core/frame/ImageBitmapTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698