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

Side by Side Diff: sky/engine/core/html/parser/BackgroundHTMLParser.cpp

Issue 673963002: Remove unused code from the Sky parser system (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 base::WeakPtr<BackgroundHTMLParser> BackgroundHTMLParser::create(PassOwnPtr<Back groundHTMLParser::Configuration> config) 52 base::WeakPtr<BackgroundHTMLParser> BackgroundHTMLParser::create(PassOwnPtr<Back groundHTMLParser::Configuration> config)
53 { 53 {
54 // Caller must free by calling stop(). 54 // Caller must free by calling stop().
55 BackgroundHTMLParser* parser = new BackgroundHTMLParser(config); 55 BackgroundHTMLParser* parser = new BackgroundHTMLParser(config);
56 return parser->m_weakFactory.GetWeakPtr(); 56 return parser->m_weakFactory.GetWeakPtr();
57 } 57 }
58 58
59 BackgroundHTMLParser::BackgroundHTMLParser(PassOwnPtr<Configuration> config) 59 BackgroundHTMLParser::BackgroundHTMLParser(PassOwnPtr<Configuration> config)
60 : m_token(adoptPtr(new HTMLToken)) 60 : m_token(adoptPtr(new HTMLToken))
61 , m_tokenizer(HTMLTokenizer::create(config->options)) 61 , m_tokenizer(HTMLTokenizer::create(config->options))
62 , m_options(config->options)
63 , m_parser(config->parser) 62 , m_parser(config->parser)
64 , m_pendingTokens(adoptPtr(new CompactHTMLTokenStream)) 63 , m_pendingTokens(adoptPtr(new CompactHTMLTokenStream))
65 , m_decoder(TextResourceDecoder::create()) 64 , m_decoder(TextResourceDecoder::create())
66 , m_weakFactory(this) 65 , m_weakFactory(this)
67 { 66 {
68 } 67 }
69 68
70 BackgroundHTMLParser::~BackgroundHTMLParser() 69 BackgroundHTMLParser::~BackgroundHTMLParser()
71 { 70 {
72 } 71 }
73 72
74 void BackgroundHTMLParser::appendRawBytesFromParserThread(const char* data, int dataLength)
75 {
76 updateDocument(m_decoder->decode(data, dataLength));
77 }
78
79 void BackgroundHTMLParser::appendRawBytesFromMainThread(PassOwnPtr<Vector<char> > buffer) 73 void BackgroundHTMLParser::appendRawBytesFromMainThread(PassOwnPtr<Vector<char> > buffer)
80 { 74 {
81 updateDocument(m_decoder->decode(buffer->data(), buffer->size())); 75 updateDocument(m_decoder->decode(buffer->data(), buffer->size()));
82 } 76 }
83 77
84 void BackgroundHTMLParser::appendDecodedBytes(const String& input) 78 void BackgroundHTMLParser::appendDecodedBytes(const String& input)
85 { 79 {
86 ASSERT(!m_input.isClosed()); 80 ASSERT(!m_input.isClosed());
87 m_input.append(SegmentedString(input)); 81 m_input.append(SegmentedString(input));
88 pumpTokenizer(); 82 pumpTokenizer();
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 void BackgroundHTMLParser::sendTokensToMainThread() 159 void BackgroundHTMLParser::sendTokensToMainThread()
166 { 160 {
167 if (m_pendingTokens->isEmpty()) 161 if (m_pendingTokens->isEmpty())
168 return; 162 return;
169 163
170 #if ENABLE(ASSERT) 164 #if ENABLE(ASSERT)
171 checkThatTokensAreSafeToSendToAnotherThread(m_pendingTokens.get()); 165 checkThatTokensAreSafeToSendToAnotherThread(m_pendingTokens.get());
172 #endif 166 #endif
173 167
174 OwnPtr<HTMLDocumentParser::ParsedChunk> chunk = adoptPtr(new HTMLDocumentPar ser::ParsedChunk); 168 OwnPtr<HTMLDocumentParser::ParsedChunk> chunk = adoptPtr(new HTMLDocumentPar ser::ParsedChunk);
175 chunk->tokenizerState = m_tokenizer->state();
176 chunk->tokens = m_pendingTokens.release(); 169 chunk->tokens = m_pendingTokens.release();
177 callOnMainThread(bind(&HTMLDocumentParser::didReceiveParsedChunkFromBackgrou ndParser, m_parser, chunk.release())); 170 callOnMainThread(bind(&HTMLDocumentParser::didReceiveParsedChunkFromBackgrou ndParser, m_parser, chunk.release()));
178 171
179 m_pendingTokens = adoptPtr(new CompactHTMLTokenStream); 172 m_pendingTokens = adoptPtr(new CompactHTMLTokenStream);
180 } 173 }
181 174
182 } 175 }
OLDNEW
« no previous file with comments | « sky/engine/core/html/parser/BackgroundHTMLParser.h ('k') | sky/engine/core/html/parser/HTMLDocumentParser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698