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

Side by Side Diff: third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.h

Issue 1402933002: Revert "Post loading tasks on the appropriate WebFrameScheduler's queue." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix bad merge Created 5 years, 2 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 18 matching lines...) Expand all
29 #include "core/html/parser/NestingLevelIncrementer.h" 29 #include "core/html/parser/NestingLevelIncrementer.h"
30 #include "platform/scheduler/CancellableTaskFactory.h" 30 #include "platform/scheduler/CancellableTaskFactory.h"
31 #include "wtf/Allocator.h" 31 #include "wtf/Allocator.h"
32 #include "wtf/PassOwnPtr.h" 32 #include "wtf/PassOwnPtr.h"
33 #include "wtf/RefPtr.h" 33 #include "wtf/RefPtr.h"
34 34
35 namespace blink { 35 namespace blink {
36 36
37 class Document; 37 class Document;
38 class HTMLDocumentParser; 38 class HTMLDocumentParser;
39 class WebTaskRunner;
40 39
41 class ActiveParserSession : public NestingLevelIncrementer { 40 class ActiveParserSession : public NestingLevelIncrementer {
42 STACK_ALLOCATED(); 41 STACK_ALLOCATED();
43 public: 42 public:
44 ActiveParserSession(unsigned& nestingLevel, Document*); 43 ActiveParserSession(unsigned& nestingLevel, Document*);
45 ~ActiveParserSession(); 44 ~ActiveParserSession();
46 45
47 private: 46 private:
48 RefPtrWillBeMember<Document> m_document; 47 RefPtrWillBeMember<Document> m_document;
49 }; 48 };
(...skipping 16 matching lines...) Expand all
66 size_t processedElementTokens() const { return m_processedElementTokens; } 65 size_t processedElementTokens() const { return m_processedElementTokens; }
67 66
68 private: 67 private:
69 double m_startTime; 68 double m_startTime;
70 size_t m_processedElementTokens; 69 size_t m_processedElementTokens;
71 }; 70 };
72 71
73 class HTMLParserScheduler { 72 class HTMLParserScheduler {
74 WTF_MAKE_NONCOPYABLE(HTMLParserScheduler); WTF_MAKE_FAST_ALLOCATED(HTMLParse rScheduler); 73 WTF_MAKE_NONCOPYABLE(HTMLParserScheduler); WTF_MAKE_FAST_ALLOCATED(HTMLParse rScheduler);
75 public: 74 public:
76 static PassOwnPtr<HTMLParserScheduler> create(HTMLDocumentParser* parser, We bTaskRunner* loadingTaskRunner) 75 static PassOwnPtr<HTMLParserScheduler> create(HTMLDocumentParser* parser)
77 { 76 {
78 return adoptPtr(new HTMLParserScheduler(parser, loadingTaskRunner)); 77 return adoptPtr(new HTMLParserScheduler(parser));
79 } 78 }
80 ~HTMLParserScheduler(); 79 ~HTMLParserScheduler();
81 80
82 bool isScheduledForResume() const { return m_isSuspendedWithActiveTimer || m _cancellableContinueParse->isPending(); } 81 bool isScheduledForResume() const { return m_isSuspendedWithActiveTimer || m _cancellableContinueParse->isPending(); }
83 82
84 void scheduleForResume(); 83 void scheduleForResume();
85 bool yieldIfNeeded(const SpeculationsPumpSession&, bool startingScript); 84 bool yieldIfNeeded(const SpeculationsPumpSession&, bool startingScript);
86 85
87 /** 86 /**
88 * Can only be called if this scheduler is suspended. If this is called, 87 * Can only be called if this scheduler is suspended. If this is called,
89 * then after the scheduler is resumed by calling resume(), this call 88 * then after the scheduler is resumed by calling resume(), this call
90 * ensures that HTMLDocumentParser::resumeAfterYield will be called. Used to 89 * ensures that HTMLDocumentParser::resumeAfterYield will be called. Used to
91 * signal this scheduler that the background html parser sent chunks to 90 * signal this scheduler that the background html parser sent chunks to
92 * HTMLDocumentParser while it was suspended. 91 * HTMLDocumentParser while it was suspended.
93 */ 92 */
94 void forceResumeAfterYield(); 93 void forceResumeAfterYield();
95 94
96 void suspend(); 95 void suspend();
97 void resume(); 96 void resume();
98 97
99 void detach(); // Clear active tasks if any. 98 void detach(); // Clear active tasks if any.
100 99
101 private: 100 private:
102 HTMLParserScheduler(HTMLDocumentParser*, WebTaskRunner*); 101 explicit HTMLParserScheduler(HTMLDocumentParser*);
103 102
104 bool shouldYield(const SpeculationsPumpSession&, bool startingScript) const; 103 bool shouldYield(const SpeculationsPumpSession&, bool startingScript) const;
105 void continueParsing(); 104 void continueParsing();
106 105
107 HTMLDocumentParser* m_parser; 106 HTMLDocumentParser* m_parser;
108 OwnPtr<WebTaskRunner> m_loadingTaskRunner; 107 WebTaskRunner* m_loadingTaskRunner; // NOT OWNED
109 108
110 OwnPtr<CancellableTaskFactory> m_cancellableContinueParse; 109 OwnPtr<CancellableTaskFactory> m_cancellableContinueParse;
111 bool m_isSuspendedWithActiveTimer; 110 bool m_isSuspendedWithActiveTimer;
112 }; 111 };
113 112
114 } 113 }
115 114
116 #endif 115 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698