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

Side by Side Diff: sky/engine/core/dom/DecodedDataDocumentParser.cpp

Issue 664573004: Live the dream (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: DEPS 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
« no previous file with comments | « sky/engine/core/dom/DecodedDataDocumentParser.h ('k') | sky/engine/core/dom/Document.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 15 matching lines...) Expand all
26 #include "config.h" 26 #include "config.h"
27 #include "core/dom/DecodedDataDocumentParser.h" 27 #include "core/dom/DecodedDataDocumentParser.h"
28 28
29 #include "core/dom/Document.h" 29 #include "core/dom/Document.h"
30 #include "core/html/parser/TextResourceDecoder.h" 30 #include "core/html/parser/TextResourceDecoder.h"
31 31
32 namespace blink { 32 namespace blink {
33 33
34 DecodedDataDocumentParser::DecodedDataDocumentParser(Document& document) 34 DecodedDataDocumentParser::DecodedDataDocumentParser(Document& document)
35 : DocumentParser(&document) 35 : DocumentParser(&document)
36 , m_decoder(TextResourceDecoder::create())
37 { 36 {
38 } 37 }
39 38
40 DecodedDataDocumentParser::~DecodedDataDocumentParser() 39 DecodedDataDocumentParser::~DecodedDataDocumentParser()
41 { 40 {
42 } 41 }
43 42
44 void DecodedDataDocumentParser::appendBytes(const char* data, size_t length)
45 {
46 if (!length)
47 return;
48
49 // This should be checking isStopped(), but XMLDocumentParser prematurely
50 // stops parsing when handling an XSLT processing instruction and still
51 // needs to receive decoded bytes.
52 if (isDetached())
53 return;
54
55 String decodedData = m_decoder->decode(data, length);
56 if (!decodedData.isEmpty())
57 append(decodedData.releaseImpl());
58 }
59
60 void DecodedDataDocumentParser::flush()
61 {
62 // This should be checking isStopped(), but XMLDocumentParser prematurely
63 // stops parsing when handling an XSLT processing instruction and still
64 // needs to receive decoded bytes.
65 if (isDetached())
66 return;
67
68 String decodedData = m_decoder->flush();
69 if (!decodedData.isEmpty())
70 append(decodedData.releaseImpl());
71 }
72
73 }; 43 };
OLDNEW
« no previous file with comments | « sky/engine/core/dom/DecodedDataDocumentParser.h ('k') | sky/engine/core/dom/Document.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698