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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 11 matching lines...) Expand all Loading... |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #include "core/html/parser/BackgroundHTMLParser.h" | 26 #include "core/html/parser/BackgroundHTMLParser.h" |
27 | 27 |
28 #include "core/HTMLNames.h" | 28 #include "core/HTMLNames.h" |
29 #include "core/html/parser/HTMLDocumentParser.h" | 29 #include "core/html/parser/HTMLDocumentParser.h" |
30 #include "core/html/parser/TextResourceDecoder.h" | 30 #include "core/html/parser/TextResourceDecoder.h" |
31 #include "core/html/parser/XSSAuditor.h" | 31 #include "core/html/parser/XSSAuditor.h" |
32 #include "platform/CrossThreadFunctional.h" | |
33 #include "platform/Histogram.h" | 32 #include "platform/Histogram.h" |
34 #include "platform/TraceEvent.h" | 33 #include "platform/TraceEvent.h" |
35 #include "public/platform/Platform.h" | 34 #include "public/platform/Platform.h" |
36 #include "public/platform/WebTaskRunner.h" | 35 #include "public/platform/WebTaskRunner.h" |
37 #include "wtf/CurrentTime.h" | 36 #include "wtf/CurrentTime.h" |
| 37 #include "wtf/Functional.h" |
38 #include "wtf/PtrUtil.h" | 38 #include "wtf/PtrUtil.h" |
39 #include "wtf/text/TextPosition.h" | 39 #include "wtf/text/TextPosition.h" |
40 #include <memory> | 40 #include <memory> |
41 | 41 |
42 namespace blink { | 42 namespace blink { |
43 | 43 |
44 // On a network with high latency and high bandwidth, using a device | 44 // On a network with high latency and high bandwidth, using a device |
45 // with a fast CPU, we could end up speculatively tokenizing | 45 // with a fast CPU, we could end up speculatively tokenizing |
46 // the whole document, well ahead of when the main-thread actually needs it. | 46 // the whole document, well ahead of when the main-thread actually needs it. |
47 // This is a waste of memory (and potentially time if the speculation fails). | 47 // This is a waste of memory (and potentially time if the speculation fails). |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 // CrossThreadClosure in these cases. This is just experimental. | 330 // CrossThreadClosure in these cases. This is just experimental. |
331 void BackgroundHTMLParser::runOnMainThread(std::unique_ptr<CrossThreadClosure> c
losure) | 331 void BackgroundHTMLParser::runOnMainThread(std::unique_ptr<CrossThreadClosure> c
losure) |
332 { | 332 { |
333 if (isMainThread()) | 333 if (isMainThread()) |
334 (*closure)(); | 334 (*closure)(); |
335 else | 335 else |
336 m_loadingTaskRunner->postTask(BLINK_FROM_HERE, std::move(closure)); | 336 m_loadingTaskRunner->postTask(BLINK_FROM_HERE, std::move(closure)); |
337 } | 337 } |
338 | 338 |
339 } // namespace blink | 339 } // namespace blink |
OLD | NEW |