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

Side by Side Diff: third_party/WebKit/Source/platform/testing/UnitTestHelpers.cpp

Issue 1995733003: Forbid Oilpan GC in blink::testing::runPendingTasks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | « no previous file | 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 /* 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 13 matching lines...) Expand all
24 */ 24 */
25 25
26 #include "platform/testing/UnitTestHelpers.h" 26 #include "platform/testing/UnitTestHelpers.h"
27 27
28 #include "base/files/file_path.h" 28 #include "base/files/file_path.h"
29 #include "base/files/file_util.h" 29 #include "base/files/file_util.h"
30 #include "base/message_loop/message_loop.h" 30 #include "base/message_loop/message_loop.h"
31 #include "base/path_service.h" 31 #include "base/path_service.h"
32 #include "platform/SharedBuffer.h" 32 #include "platform/SharedBuffer.h"
33 #include "platform/Timer.h" 33 #include "platform/Timer.h"
34 #include "platform/heap/Handle.h"
34 #include "public/platform/FilePathConversion.h" 35 #include "public/platform/FilePathConversion.h"
35 #include "public/platform/Platform.h" 36 #include "public/platform/Platform.h"
36 #include "public/platform/WebString.h" 37 #include "public/platform/WebString.h"
37 #include "public/platform/WebTaskRunner.h" 38 #include "public/platform/WebTaskRunner.h"
38 #include "public/platform/WebThread.h" 39 #include "public/platform/WebThread.h"
39 #include "public/platform/WebTraceLocation.h" 40 #include "public/platform/WebTraceLocation.h"
40 #include "wtf/text/StringUTF8Adaptor.h" 41 #include "wtf/text/StringUTF8Adaptor.h"
41 42
42 namespace blink { 43 namespace blink {
43 namespace testing { 44 namespace testing {
44 45
45 void runPendingTasks() 46 void runPendingTasks()
46 { 47 {
47 Platform::current()->currentThread()->getWebTaskRunner()->postTask(BLINK_FRO M_HERE, bind(&exitRunLoop)); 48 Platform::current()->currentThread()->getWebTaskRunner()->postTask(BLINK_FRO M_HERE, bind(&exitRunLoop));
49
50 // We forbid GC in the tasks. Otherwise the registered GCTaskObserver tries
51 // to run GC with NoHeapPointerOnStack.
52 ThreadState::current()->enterGCForbiddenScope();
48 enterRunLoop(); 53 enterRunLoop();
54 ThreadState::current()->leaveGCForbiddenScope();
49 } 55 }
50 56
51 void runDelayedTasks(double delayMs) 57 void runDelayedTasks(double delayMs)
52 { 58 {
53 Platform::current()->currentThread()->getWebTaskRunner()->postDelayedTask(BL INK_FROM_HERE, bind(&exitRunLoop), delayMs); 59 Platform::current()->currentThread()->getWebTaskRunner()->postDelayedTask(BL INK_FROM_HERE, bind(&exitRunLoop), delayMs);
54 enterRunLoop(); 60 enterRunLoop();
55 } 61 }
56 62
57 String blinkRootDir() 63 String blinkRootDir()
58 { 64 {
(...skipping 22 matching lines...) Expand all
81 base::MessageLoop::current()->QuitWhenIdle(); 87 base::MessageLoop::current()->QuitWhenIdle();
82 } 88 }
83 89
84 void yieldCurrentThread() 90 void yieldCurrentThread()
85 { 91 {
86 base::PlatformThread::YieldCurrentThread(); 92 base::PlatformThread::YieldCurrentThread();
87 } 93 }
88 94
89 } // namespace testing 95 } // namespace testing
90 } // namespace blink 96 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698