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

Side by Side Diff: third_party/WebKit/Source/core/html/parser/HTMLParserThread.cpp

Issue 1682423002: Remove WebWaitableEvent and replace it with WaitableEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix android build Created 4 years, 10 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
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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 14 matching lines...) Expand all
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "core/html/parser/HTMLParserThread.h" 31 #include "core/html/parser/HTMLParserThread.h"
32 32
33 #include "platform/Task.h" 33 #include "platform/Task.h"
34 #include "platform/ThreadSafeFunctional.h" 34 #include "platform/ThreadSafeFunctional.h"
35 #include "platform/WaitableEvent.h"
35 #include "platform/heap/SafePoint.h" 36 #include "platform/heap/SafePoint.h"
36 #include "public/platform/Platform.h" 37 #include "public/platform/Platform.h"
37 #include "public/platform/WebTraceLocation.h" 38 #include "public/platform/WebTraceLocation.h"
38 #include "public/platform/WebWaitableEvent.h"
39 #include "wtf/PassOwnPtr.h" 39 #include "wtf/PassOwnPtr.h"
40 40
41 namespace blink { 41 namespace blink {
42 42
43 static HTMLParserThread* s_sharedThread = 0; 43 static HTMLParserThread* s_sharedThread = 0;
44 44
45 HTMLParserThread::HTMLParserThread() 45 HTMLParserThread::HTMLParserThread()
46 { 46 {
47 } 47 }
48 48
(...skipping 11 matching lines...) Expand all
60 { 60 {
61 ASSERT(m_thread); 61 ASSERT(m_thread);
62 m_thread->initialize(); 62 m_thread->initialize();
63 } 63 }
64 64
65 void HTMLParserThread::shutdown() 65 void HTMLParserThread::shutdown()
66 { 66 {
67 ASSERT(s_sharedThread); 67 ASSERT(s_sharedThread);
68 // currentThread will always be non-null in production, but can be null in C hromium unit tests. 68 // currentThread will always be non-null in production, but can be null in C hromium unit tests.
69 if (Platform::current()->currentThread() && s_sharedThread->isRunning()) { 69 if (Platform::current()->currentThread() && s_sharedThread->isRunning()) {
70 OwnPtr<WebWaitableEvent> waitableEvent(adoptPtr(Platform::current()->cre ateWaitableEvent())); 70 OwnPtr<WaitableEvent> waitableEvent(adoptPtr(new WaitableEvent()));
71 s_sharedThread->postTask(threadSafeBind(&HTMLParserThread::cleanupHTMLPa rserThread, AllowCrossThreadAccess(s_sharedThread), AllowCrossThreadAccess(waita bleEvent.get()))); 71 s_sharedThread->postTask(threadSafeBind(&HTMLParserThread::cleanupHTMLPa rserThread, AllowCrossThreadAccess(s_sharedThread), AllowCrossThreadAccess(waita bleEvent.get())));
72 SafePointScope scope(BlinkGC::HeapPointersOnStack); 72 SafePointScope scope(BlinkGC::HeapPointersOnStack);
73 waitableEvent->wait(); 73 waitableEvent->wait();
74 } 74 }
75 delete s_sharedThread; 75 delete s_sharedThread;
76 s_sharedThread = 0; 76 s_sharedThread = 0;
77 } 77 }
78 78
79 void HTMLParserThread::cleanupHTMLParserThread(WebWaitableEvent* waitableEvent) 79 void HTMLParserThread::cleanupHTMLParserThread(WaitableEvent* waitableEvent)
80 { 80 {
81 m_thread->shutdown(); 81 m_thread->shutdown();
82 waitableEvent->signal(); 82 waitableEvent->signal();
83 } 83 }
84 84
85 HTMLParserThread* HTMLParserThread::shared() 85 HTMLParserThread* HTMLParserThread::shared()
86 { 86 {
87 return s_sharedThread; 87 return s_sharedThread;
88 } 88 }
89 89
(...skipping 10 matching lines...) Expand all
100 { 100 {
101 return !!m_thread; 101 return !!m_thread;
102 } 102 }
103 103
104 void HTMLParserThread::postTask(PassOwnPtr<Closure> closure) 104 void HTMLParserThread::postTask(PassOwnPtr<Closure> closure)
105 { 105 {
106 platformThread().taskRunner()->postTask(BLINK_FROM_HERE, new Task(closure)); 106 platformThread().taskRunner()->postTask(BLINK_FROM_HERE, new Task(closure));
107 } 107 }
108 108
109 } // namespace blink 109 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698