| 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 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 } | 50 } |
| 51 | 51 |
| 52 void HTMLParserThread::setupHTMLParserThread() { | 52 void HTMLParserThread::setupHTMLParserThread() { |
| 53 ASSERT(m_thread); | 53 ASSERT(m_thread); |
| 54 m_thread->initialize(); | 54 m_thread->initialize(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void HTMLParserThread::shutdown() { | 57 void HTMLParserThread::shutdown() { |
| 58 ASSERT(isMainThread()); | 58 ASSERT(isMainThread()); |
| 59 ASSERT(s_sharedThread); | 59 ASSERT(s_sharedThread); |
| 60 // currentThread will always be non-null in production, but can be null in Chr
omium unit tests. | 60 // currentThread will always be non-null in production, but can be null in |
| 61 // Chromium unit tests. |
| 61 if (Platform::current()->currentThread() && s_sharedThread->m_thread) { | 62 if (Platform::current()->currentThread() && s_sharedThread->m_thread) { |
| 62 WaitableEvent waitableEvent; | 63 WaitableEvent waitableEvent; |
| 63 s_sharedThread->postTask( | 64 s_sharedThread->postTask( |
| 64 crossThreadBind(&HTMLParserThread::cleanupHTMLParserThread, | 65 crossThreadBind(&HTMLParserThread::cleanupHTMLParserThread, |
| 65 crossThreadUnretained(s_sharedThread), | 66 crossThreadUnretained(s_sharedThread), |
| 66 crossThreadUnretained(&waitableEvent))); | 67 crossThreadUnretained(&waitableEvent))); |
| 67 waitableEvent.wait(); | 68 waitableEvent.wait(); |
| 68 } | 69 } |
| 69 delete s_sharedThread; | 70 delete s_sharedThread; |
| 70 s_sharedThread = nullptr; | 71 s_sharedThread = nullptr; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 85 m_thread = WebThreadSupportingGC::create("HTMLParserThread", | 86 m_thread = WebThreadSupportingGC::create("HTMLParserThread", |
| 86 BlinkGC::MainThreadHeapMode); | 87 BlinkGC::MainThreadHeapMode); |
| 87 postTask(crossThreadBind(&HTMLParserThread::setupHTMLParserThread, | 88 postTask(crossThreadBind(&HTMLParserThread::setupHTMLParserThread, |
| 88 crossThreadUnretained(this))); | 89 crossThreadUnretained(this))); |
| 89 } | 90 } |
| 90 | 91 |
| 91 m_thread->postTask(BLINK_FROM_HERE, std::move(closure)); | 92 m_thread->postTask(BLINK_FROM_HERE, std::move(closure)); |
| 92 } | 93 } |
| 93 | 94 |
| 94 } // namespace blink | 95 } // namespace blink |
| OLD | NEW |