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

Side by Side Diff: Source/core/loader/TextResourceDecoderBuilder.cpp

Issue 17640007: Refactoring: Simplify DocumentWriter by reorganizing its lifetime. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Re-landing after fixing ASAN failure on set-parent-src-synchronously.xhtml. Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/loader/TextResourceDecoderBuilder.h ('k') | Source/core/svg/graphics/SVGImage.cpp » ('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) 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 26 matching lines...) Expand all
37 #include "weborigin/SecurityOrigin.h" 37 #include "weborigin/SecurityOrigin.h"
38 38
39 namespace WebCore { 39 namespace WebCore {
40 40
41 static inline bool canReferToParentFrameEncoding(const Frame* frame, const Frame * parentFrame) 41 static inline bool canReferToParentFrameEncoding(const Frame* frame, const Frame * parentFrame)
42 { 42 {
43 return parentFrame && parentFrame->document()->securityOrigin()->canAccess(f rame->document()->securityOrigin()); 43 return parentFrame && parentFrame->document()->securityOrigin()->canAccess(f rame->document()->securityOrigin());
44 } 44 }
45 45
46 46
47 TextResourceDecoderBuilder::TextResourceDecoderBuilder() 47 TextResourceDecoderBuilder::TextResourceDecoderBuilder(const String& mimeType, c onst String& encoding, bool encodingUserChoosen)
48 : m_encodingWasChosenByUser(false) 48 : m_mimeType(mimeType)
49 , m_encoding(encoding)
50 , m_encodingWasChosenByUser(encodingUserChoosen)
49 { 51 {
50 } 52 }
51 53
52 TextResourceDecoderBuilder::~TextResourceDecoderBuilder() 54 TextResourceDecoderBuilder::~TextResourceDecoderBuilder()
53 { 55 {
54 } 56 }
55 57
56 58
57 inline PassRefPtr<TextResourceDecoder> TextResourceDecoderBuilder::createDecoder Instance(Document* document) 59 inline PassRefPtr<TextResourceDecoder> TextResourceDecoderBuilder::createDecoder Instance(Document* document)
58 { 60 {
(...skipping 30 matching lines...) Expand all
89 } 91 }
90 92
91 PassRefPtr<TextResourceDecoder> TextResourceDecoderBuilder::buildFor(Document* d ocument) 93 PassRefPtr<TextResourceDecoder> TextResourceDecoderBuilder::buildFor(Document* d ocument)
92 { 94 {
93 RefPtr<TextResourceDecoder> decoder = createDecoderInstance(document); 95 RefPtr<TextResourceDecoder> decoder = createDecoderInstance(document);
94 setupEncoding(decoder.get(), document); 96 setupEncoding(decoder.get(), document);
95 document->setDecoder(decoder); 97 document->setDecoder(decoder);
96 return decoder.release(); 98 return decoder.release();
97 } 99 }
98 100
99 void TextResourceDecoderBuilder::setEncoding(const String& encoding, bool userCh osen)
100 {
101 m_encoding = encoding;
102 m_encodingWasChosenByUser = userChosen;
103 }
104
105 void TextResourceDecoderBuilder::clear() 101 void TextResourceDecoderBuilder::clear()
106 { 102 {
107 if (!m_encodingWasChosenByUser) 103 if (!m_encodingWasChosenByUser)
108 m_encoding = String(); 104 m_encoding = String();
109 } 105 }
110 106
111 } 107 }
OLDNEW
« no previous file with comments | « Source/core/loader/TextResourceDecoderBuilder.h ('k') | Source/core/svg/graphics/SVGImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698