OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 // We forbid GC in the tasks. Otherwise the registered GCTaskObserver tries | 62 // We forbid GC in the tasks. Otherwise the registered GCTaskObserver tries |
63 // to run GC with NoHeapPointerOnStack. | 63 // to run GC with NoHeapPointerOnStack. |
64 ThreadState::Current()->EnterGCForbiddenScope(); | 64 ThreadState::Current()->EnterGCForbiddenScope(); |
65 EnterRunLoop(); | 65 EnterRunLoop(); |
66 ThreadState::Current()->LeaveGCForbiddenScope(); | 66 ThreadState::Current()->LeaveGCForbiddenScope(); |
67 } | 67 } |
68 | 68 |
69 void RunDelayedTasks(double delay_ms) { | 69 void RunDelayedTasks(double delay_ms) { |
70 Platform::Current()->CurrentThread()->GetWebTaskRunner()->PostDelayedTask( | 70 Platform::Current()->CurrentThread()->GetWebTaskRunner()->PostDelayedTask( |
71 BLINK_FROM_HERE, WTF::Bind(&ExitRunLoop), delay_ms); | 71 BLINK_FROM_HERE, WTF::Bind(&ExitRunLoop), |
| 72 TimeDelta::FromMillisecondsD(delay_ms)); |
72 EnterRunLoop(); | 73 EnterRunLoop(); |
73 } | 74 } |
74 | 75 |
75 void EnterRunLoop() { | 76 void EnterRunLoop() { |
76 base::RunLoop().Run(); | 77 base::RunLoop().Run(); |
77 } | 78 } |
78 | 79 |
79 void ExitRunLoop() { | 80 void ExitRunLoop() { |
80 base::MessageLoop::current()->QuitWhenIdle(); | 81 base::MessageLoop::current()->QuitWhenIdle(); |
81 } | 82 } |
(...skipping 22 matching lines...) Expand all Loading... |
104 | 105 |
105 PassRefPtr<SharedBuffer> ReadFromFile(const String& path) { | 106 PassRefPtr<SharedBuffer> ReadFromFile(const String& path) { |
106 base::FilePath file_path = blink::WebStringToFilePath(path); | 107 base::FilePath file_path = blink::WebStringToFilePath(path); |
107 std::string buffer; | 108 std::string buffer; |
108 base::ReadFileToString(file_path, &buffer); | 109 base::ReadFileToString(file_path, &buffer); |
109 return SharedBuffer::Create(buffer.data(), buffer.size()); | 110 return SharedBuffer::Create(buffer.data(), buffer.size()); |
110 } | 111 } |
111 | 112 |
112 } // namespace testing | 113 } // namespace testing |
113 } // namespace blink | 114 } // namespace blink |
OLD | NEW |