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

Side by Side Diff: third_party/WebKit/Source/core/fetch/TextResource.cpp

Issue 2202173002: Refactoring: Make Resource::m_data private (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address on hiroshige's review Created 4 years, 4 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/fetch/TextResource.h" 5 #include "core/fetch/TextResource.h"
6 6
7 #include "core/html/parser/TextResourceDecoder.h" 7 #include "core/html/parser/TextResourceDecoder.h"
8 #include "platform/SharedBuffer.h" 8 #include "platform/SharedBuffer.h"
9 #include "wtf/text/StringBuilder.h" 9 #include "wtf/text/StringBuilder.h"
10 10
(...skipping 14 matching lines...) Expand all
25 m_decoder->setEncoding(chs, TextResourceDecoder::EncodingFromHTTPHeader); 25 m_decoder->setEncoding(chs, TextResourceDecoder::EncodingFromHTTPHeader);
26 } 26 }
27 27
28 String TextResource::encoding() const 28 String TextResource::encoding() const
29 { 29 {
30 return m_decoder->encoding().name(); 30 return m_decoder->encoding().name();
31 } 31 }
32 32
33 String TextResource::decodedText() const 33 String TextResource::decodedText() const
34 { 34 {
35 ASSERT(m_data); 35 DCHECK(data());
36 36
37 StringBuilder builder; 37 StringBuilder builder;
38 const char* data; 38 const char* segment;
39 size_t position = 0; 39 size_t position = 0;
40 while (size_t length = m_data->getSomeData(data, position)) { 40 while (size_t length = data()->getSomeData(segment, position)) {
41 builder.append(m_decoder->decode(data, length)); 41 builder.append(m_decoder->decode(segment, length));
42 position += length; 42 position += length;
43 } 43 }
44 builder.append(m_decoder->flush()); 44 builder.append(m_decoder->flush());
45 return builder.toString(); 45 return builder.toString();
46 } 46 }
47 47
48 } // namespace blink 48 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698