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/platform/chromium/support/WebString.cpp

Issue 15866003: Teach WebString about 8 bit strings (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update to base Created 7 years, 6 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 | « no previous file | public/platform/WebCommon.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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 { 68 {
69 ASSERT(m_private); 69 ASSERT(m_private);
70 return (*m_private)[i]; 70 return (*m_private)[i];
71 } 71 }
72 72
73 const WebUChar* WebString::data() const 73 const WebUChar* WebString::data() const
74 { 74 {
75 return m_private ? const_cast<WebStringPrivate*>(m_private)->characters() : 0; 75 return m_private ? const_cast<WebStringPrivate*>(m_private)->characters() : 0;
76 } 76 }
77 77
78 bool WebString::is8Bit() const
79 {
80 return m_private->is8Bit();
81 }
82
83 const WebLChar* WebString::data8() const
84 {
85 return m_private && is8Bit() ? m_private->characters8() : 0;
86 }
87
88 const WebUChar* WebString::data16() const
89 {
90 return m_private && !is8Bit() ? m_private->characters16() : 0;
91 }
92
78 WebCString WebString::utf8() const 93 WebCString WebString::utf8() const
79 { 94 {
80 return WTF::String(m_private).utf8(); 95 return WTF::String(m_private).utf8();
81 } 96 }
82 97
83 WebString WebString::fromUTF8(const char* data, size_t length) 98 WebString WebString::fromUTF8(const char* data, size_t length)
84 { 99 {
85 return WTF::String::fromUTF8(data, length); 100 return WTF::String::fromUTF8(data, length);
86 } 101 }
87 102
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 { 149 {
135 // Take care to handle the case where m_private == p 150 // Take care to handle the case where m_private == p
136 if (p) 151 if (p)
137 p->ref(); 152 p->ref();
138 if (m_private) 153 if (m_private)
139 m_private->deref(); 154 m_private->deref();
140 m_private = p; 155 m_private = p;
141 } 156 }
142 157
143 } // namespace WebKit 158 } // namespace WebKit
OLDNEW
« no previous file with comments | « no previous file | public/platform/WebCommon.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698