OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * Copyright (C) 2013 Google Inc. All Rights Reserved. | 3 * Copyright (C) 2013 Google Inc. All Rights Reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 29 matching lines...) Expand all Loading... |
40 namespace blink { | 40 namespace blink { |
41 | 41 |
42 class MarkingBooleanTask final : public ExecutionContextTask { | 42 class MarkingBooleanTask final : public ExecutionContextTask { |
43 public: | 43 public: |
44 static PassOwnPtr<MarkingBooleanTask> create(bool* toBeMarked) | 44 static PassOwnPtr<MarkingBooleanTask> create(bool* toBeMarked) |
45 { | 45 { |
46 return adoptPtr(new MarkingBooleanTask(toBeMarked)); | 46 return adoptPtr(new MarkingBooleanTask(toBeMarked)); |
47 } | 47 } |
48 | 48 |
49 | 49 |
50 virtual ~MarkingBooleanTask() { } | 50 ~MarkingBooleanTask() override { } |
51 | 51 |
52 private: | 52 private: |
53 MarkingBooleanTask(bool* toBeMarked) : m_toBeMarked(toBeMarked) { } | 53 MarkingBooleanTask(bool* toBeMarked) : m_toBeMarked(toBeMarked) { } |
54 | 54 |
55 virtual void performTask(ExecutionContext* context) override | 55 void performTask(ExecutionContext* context) override |
56 { | 56 { |
57 *m_toBeMarked = true; | 57 *m_toBeMarked = true; |
58 } | 58 } |
59 | 59 |
60 bool* m_toBeMarked; | 60 bool* m_toBeMarked; |
61 }; | 61 }; |
62 | 62 |
63 TEST(MainThreadTaskRunnerTest, PostTask) | 63 TEST(MainThreadTaskRunnerTest, PostTask) |
64 { | 64 { |
65 RefPtrWillBeRawPtr<NullExecutionContext> context = adoptRefWillBeNoop(new Nu
llExecutionContext()); | 65 RefPtrWillBeRawPtr<NullExecutionContext> context = adoptRefWillBeNoop(new Nu
llExecutionContext()); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 bool isMarked = false; | 97 bool isMarked = false; |
98 | 98 |
99 context->setTasksNeedSuspension(true); | 99 context->setTasksNeedSuspension(true); |
100 runner->postTask(FROM_HERE, MarkingBooleanTask::create(&isMarked)); | 100 runner->postTask(FROM_HERE, MarkingBooleanTask::create(&isMarked)); |
101 runner.clear(); | 101 runner.clear(); |
102 blink::testing::runPendingTasks(); | 102 blink::testing::runPendingTasks(); |
103 EXPECT_FALSE(isMarked); | 103 EXPECT_FALSE(isMarked); |
104 } | 104 } |
105 | 105 |
106 } // namespace blink | 106 } // namespace blink |
OLD | NEW |