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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8StringResource.h

Issue 2386173002: reflow comments in Source/bindings/core/v8 (Closed)
Patch Set: Created 4 years, 2 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 /* 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 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 m_atomicString = AtomicString(m_plainString); 84 m_atomicString = AtomicString(m_plainString);
85 ASSERT(!m_atomicString.isNull()); 85 ASSERT(!m_atomicString.isNull());
86 if (m_plainString.impl() != m_atomicString.impl()) 86 if (m_plainString.impl() != m_atomicString.impl())
87 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory( 87 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(
88 m_atomicString.charactersSizeInBytes()); 88 m_atomicString.charactersSizeInBytes());
89 } 89 }
90 return m_atomicString; 90 return m_atomicString;
91 } 91 }
92 92
93 protected: 93 protected:
94 // A shallow copy of the string. Keeps the string buffer alive until the V8 en gine garbage collects it. 94 // A shallow copy of the string. Keeps the string buffer alive until the V8
95 // engine garbage collects it.
95 String m_plainString; 96 String m_plainString;
96 // If this string is atomic or has been made atomic earlier the 97 // If this string is atomic or has been made atomic earlier the
97 // atomic string is held here. In the case where the string starts 98 // atomic string is held here. In the case where the string starts
98 // off non-atomic and becomes atomic later it is necessary to keep 99 // off non-atomic and becomes atomic later it is necessary to keep
99 // the original string alive because v8 may keep derived pointers 100 // the original string alive because v8 may keep derived pointers
100 // into that string. 101 // into that string.
101 AtomicString m_atomicString; 102 AtomicString m_atomicString;
102 103
103 private: 104 private:
104 #if ENABLE(ASSERT) 105 #if ENABLE(ASSERT)
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 } 198 }
198 199
199 bool prepare(ExceptionState& exceptionState) { 200 bool prepare(ExceptionState& exceptionState) {
200 if (prepareFast()) 201 if (prepareFast())
201 return true; 202 return true;
202 203
203 // TODO(bashi): Pass an isolate to this function and remove 204 // TODO(bashi): Pass an isolate to this function and remove
204 // v8::Isolate::GetCurrent(). 205 // v8::Isolate::GetCurrent().
205 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 206 v8::Isolate* isolate = v8::Isolate::GetCurrent();
206 v8::TryCatch block(isolate); 207 v8::TryCatch block(isolate);
207 // Handle the case where an exception is thrown as part of invoking toString on the object. 208 // Handle the case where an exception is thrown as part of invoking toString
209 // on the object.
208 if (!m_v8Object->ToString(isolate->GetCurrentContext()) 210 if (!m_v8Object->ToString(isolate->GetCurrentContext())
209 .ToLocal(&m_v8Object)) { 211 .ToLocal(&m_v8Object)) {
210 exceptionState.rethrowV8Exception(block.Exception()); 212 exceptionState.rethrowV8Exception(block.Exception());
211 return false; 213 return false;
212 } 214 }
213 return true; 215 return true;
214 } 216 }
215 217
216 operator String() const { return toString<String>(); } 218 operator String() const { return toString<String>(); }
217 operator AtomicString() const { return toString<AtomicString>(); } 219 operator AtomicString() const { return toString<AtomicString>(); }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 302
301 template <> 303 template <>
302 inline String 304 inline String
303 V8StringResource<TreatNullAndUndefinedAsNullString>::fallbackString() const { 305 V8StringResource<TreatNullAndUndefinedAsNullString>::fallbackString() const {
304 return String(); 306 return String();
305 } 307 }
306 308
307 } // namespace blink 309 } // namespace blink
308 310
309 #endif // V8StringResource_h 311 #endif // V8StringResource_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698