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

Side by Side Diff: Source/core/html/parser/HTMLDocumentParser.cpp

Issue 1087203002: Patch 2/3 to get WebScheduler via WebThread (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Style nits Created 5 years, 8 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) 2010 Google, Inc. All Rights Reserved. 2 * Copyright (C) 2010 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 28 matching lines...) Expand all
39 #include "core/html/parser/HTMLParserThread.h" 39 #include "core/html/parser/HTMLParserThread.h"
40 #include "core/html/parser/HTMLScriptRunner.h" 40 #include "core/html/parser/HTMLScriptRunner.h"
41 #include "core/html/parser/HTMLTreeBuilder.h" 41 #include "core/html/parser/HTMLTreeBuilder.h"
42 #include "core/inspector/InspectorInstrumentation.h" 42 #include "core/inspector/InspectorInstrumentation.h"
43 #include "core/inspector/InspectorTraceEvents.h" 43 #include "core/inspector/InspectorTraceEvents.h"
44 #include "core/loader/DocumentLoader.h" 44 #include "core/loader/DocumentLoader.h"
45 #include "platform/SharedBuffer.h" 45 #include "platform/SharedBuffer.h"
46 #include "platform/ThreadedDataReceiver.h" 46 #include "platform/ThreadedDataReceiver.h"
47 #include "platform/TraceEvent.h" 47 #include "platform/TraceEvent.h"
48 #include "platform/heap/Handle.h" 48 #include "platform/heap/Handle.h"
49 #include "platform/scheduler/Scheduler.h" 49 #include "public/platform/Platform.h"
50 #include "public/platform/WebScheduler.h"
51 #include "public/platform/WebThread.h"
50 #include "wtf/Functional.h" 52 #include "wtf/Functional.h"
51 #include "wtf/RefCounted.h" 53 #include "wtf/RefCounted.h"
52 #include "wtf/TemporaryChange.h" 54 #include "wtf/TemporaryChange.h"
53 55
54 namespace blink { 56 namespace blink {
55 57
56 using namespace HTMLNames; 58 using namespace HTMLNames;
57 59
58 // This is a direct transcription of step 4 from: 60 // This is a direct transcription of step 4 from:
59 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#frag ment-case 61 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#frag ment-case
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 OwnPtr<BackgroundHTMLParser::Configuration> config = adoptPtr(new Background HTMLParser::Configuration); 780 OwnPtr<BackgroundHTMLParser::Configuration> config = adoptPtr(new Background HTMLParser::Configuration);
779 config->options = m_options; 781 config->options = m_options;
780 config->parser = m_weakFactory.createWeakPtr(); 782 config->parser = m_weakFactory.createWeakPtr();
781 config->xssAuditor = adoptPtr(new XSSAuditor); 783 config->xssAuditor = adoptPtr(new XSSAuditor);
782 config->xssAuditor->init(document(), &m_xssAuditorDelegate); 784 config->xssAuditor->init(document(), &m_xssAuditorDelegate);
783 config->preloadScanner = adoptPtr(new TokenPreloadScanner(document()->url(). copy(), createMediaValues(document()))); 785 config->preloadScanner = adoptPtr(new TokenPreloadScanner(document()->url(). copy(), createMediaValues(document())));
784 config->decoder = takeDecoder(); 786 config->decoder = takeDecoder();
785 787
786 ASSERT(config->xssAuditor->isSafeToSendToAnotherThread()); 788 ASSERT(config->xssAuditor->isSafeToSendToAnotherThread());
787 ASSERT(config->preloadScanner->isSafeToSendToAnotherThread()); 789 ASSERT(config->preloadScanner->isSafeToSendToAnotherThread());
788 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::start, refe rence.release(), config.release(), Scheduler::shared())); 790 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::start, refe rence.release(), config.release(),
791 Platform::current()->currentThread()->scheduler()));
789 } 792 }
790 793
791 void HTMLDocumentParser::stopBackgroundParser() 794 void HTMLDocumentParser::stopBackgroundParser()
792 { 795 {
793 ASSERT(shouldUseThreading()); 796 ASSERT(shouldUseThreading());
794 ASSERT(m_haveBackgroundParser); 797 ASSERT(m_haveBackgroundParser);
795 m_haveBackgroundParser = false; 798 m_haveBackgroundParser = false;
796 799
797 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::stop, m_bac kgroundParser)); 800 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::stop, m_bac kgroundParser));
798 m_weakFactory.revokeAll(); 801 m_weakFactory.revokeAll();
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) 1109 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder)
1107 { 1110 {
1108 ASSERT(decoder); 1111 ASSERT(decoder);
1109 DecodedDataDocumentParser::setDecoder(decoder); 1112 DecodedDataDocumentParser::setDecoder(decoder);
1110 1113
1111 if (m_haveBackgroundParser) 1114 if (m_haveBackgroundParser)
1112 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco der, m_backgroundParser, takeDecoder())); 1115 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco der, m_backgroundParser, takeDecoder()));
1113 } 1116 }
1114 1117
1115 } 1118 }
OLDNEW
« no previous file with comments | « Source/core/html/parser/BackgroundHTMLParser.cpp ('k') | Source/core/html/parser/HTMLParserScheduler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698