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

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

Issue 1835773002: Rename AtomicString::string() to AtomicString::getString(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Windows Created 4 years, 8 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/build/scripts/make_css_property_names.py » ('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 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 : m_plainString(string) 46 : m_plainString(string)
47 { 47 {
48 #if ENABLE(ASSERT) 48 #if ENABLE(ASSERT)
49 m_threadId = WTF::currentThread(); 49 m_threadId = WTF::currentThread();
50 #endif 50 #endif
51 ASSERT(!string.isNull()); 51 ASSERT(!string.isNull());
52 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(memoryC onsumption(string)); 52 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(memoryC onsumption(string));
53 } 53 }
54 54
55 explicit WebCoreStringResourceBase(const AtomicString& string) 55 explicit WebCoreStringResourceBase(const AtomicString& string)
56 : m_plainString(string.string()) 56 : m_plainString(string.getString())
57 , m_atomicString(string) 57 , m_atomicString(string)
58 { 58 {
59 #if ENABLE(ASSERT) 59 #if ENABLE(ASSERT)
60 m_threadId = WTF::currentThread(); 60 m_threadId = WTF::currentThread();
61 #endif 61 #endif
62 ASSERT(!string.isNull()); 62 ASSERT(!string.isNull());
63 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(memoryC onsumption(string)); 63 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(memoryC onsumption(string));
64 } 64 }
65 65
66 explicit WebCoreStringResourceBase(const CompressibleString& string) 66 explicit WebCoreStringResourceBase(const CompressibleString& string)
67 : m_compressibleString(string) 67 : m_compressibleString(string)
68 { 68 {
69 #if ENABLE(ASSERT) 69 #if ENABLE(ASSERT)
70 m_threadId = WTF::currentThread(); 70 m_threadId = WTF::currentThread();
71 #endif 71 #endif
72 ASSERT(!string.isNull()); 72 ASSERT(!string.isNull());
73 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(memoryC onsumption(string)); 73 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(memoryC onsumption(string));
74 } 74 }
75 75
76 virtual ~WebCoreStringResourceBase() 76 virtual ~WebCoreStringResourceBase()
77 { 77 {
78 #if ENABLE(ASSERT) 78 #if ENABLE(ASSERT)
79 ASSERT(m_threadId == WTF::currentThread()); 79 ASSERT(m_threadId == WTF::currentThread());
80 #endif 80 #endif
81 int reducedExternalMemory = 0; 81 int reducedExternalMemory = 0;
82 if (LIKELY(m_compressibleString.isNull())) { 82 if (LIKELY(m_compressibleString.isNull())) {
83 reducedExternalMemory = -memoryConsumption(m_plainString); 83 reducedExternalMemory = -memoryConsumption(m_plainString);
84 if (m_plainString.impl() != m_atomicString.impl() && !m_atomicString .isNull()) 84 if (m_plainString.impl() != m_atomicString.impl() && !m_atomicString .isNull())
85 reducedExternalMemory -= memoryConsumption(m_atomicString.string ()); 85 reducedExternalMemory -= memoryConsumption(m_atomicString.getStr ing());
86 } else { 86 } else {
87 reducedExternalMemory = -memoryConsumption(m_compressibleString); 87 reducedExternalMemory = -memoryConsumption(m_compressibleString);
88 } 88 }
89 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(reduced ExternalMemory); 89 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(reduced ExternalMemory);
90 } 90 }
91 91
92 const String& webcoreString() 92 const String& webcoreString()
93 { 93 {
94 if (UNLIKELY(!m_compressibleString.isNull())) { 94 if (UNLIKELY(!m_compressibleString.isNull())) {
95 ASSERT(m_plainString.isNull()); 95 ASSERT(m_plainString.isNull());
(...skipping 10 matching lines...) Expand all
106 #endif 106 #endif
107 if (UNLIKELY(!m_compressibleString.isNull())) { 107 if (UNLIKELY(!m_compressibleString.isNull())) {
108 ASSERT(m_plainString.isNull()); 108 ASSERT(m_plainString.isNull());
109 ASSERT(m_atomicString.isNull()); 109 ASSERT(m_atomicString.isNull());
110 return AtomicString(m_compressibleString.toString()); 110 return AtomicString(m_compressibleString.toString());
111 } 111 }
112 if (m_atomicString.isNull()) { 112 if (m_atomicString.isNull()) {
113 m_atomicString = AtomicString(m_plainString); 113 m_atomicString = AtomicString(m_plainString);
114 ASSERT(!m_atomicString.isNull()); 114 ASSERT(!m_atomicString.isNull());
115 if (m_plainString.impl() != m_atomicString.impl()) 115 if (m_plainString.impl() != m_atomicString.impl())
116 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory (memoryConsumption(m_atomicString.string())); 116 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory (memoryConsumption(m_atomicString.getString()));
117 } 117 }
118 return m_atomicString; 118 return m_atomicString;
119 } 119 }
120 120
121 const CompressibleString& getCompressibleString() { return m_compressibleStr ing; } 121 const CompressibleString& getCompressibleString() { return m_compressibleStr ing; }
122 122
123 protected: 123 protected:
124 // A shallow copy of the string. Keeps the string buffer alive until the V8 engine garbage collects it. 124 // A shallow copy of the string. Keeps the string buffer alive until the V8 engine garbage collects it.
125 String m_plainString; 125 String m_plainString;
126 // If this string is atomic or has been made atomic earlier the 126 // If this string is atomic or has been made atomic earlier the
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 } 403 }
404 404
405 template<> inline String V8StringResource<TreatNullAndUndefinedAsNullString>::fa llbackString() const 405 template<> inline String V8StringResource<TreatNullAndUndefinedAsNullString>::fa llbackString() const
406 { 406 {
407 return String(); 407 return String();
408 } 408 }
409 409
410 } // namespace blink 410 } // namespace blink
411 411
412 #endif // V8StringResource_h 412 #endif // V8StringResource_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/build/scripts/make_css_property_names.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698