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

Side by Side Diff: Source/bindings/v8/V8ValueCache.cpp

Issue 13973026: remove memoryinstrumentation Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove the rest part of MemoryInstrumentation Created 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/bindings/v8/V8ValueCache.h ('k') | Source/core/core.gypi » ('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
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE. 23 * THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #include "config.h" 26 #include "config.h"
27 #include "V8ValueCache.h" 27 #include "V8ValueCache.h"
28 28
29 #include "V8Binding.h" 29 #include "V8Binding.h"
30 #include "WebCoreMemoryInstrumentation.h"
31 #include <wtf/MemoryInstrumentationHashMap.h>
32
33 namespace WTF {
34
35 template<> struct SequenceMemoryInstrumentationTraits<v8::String*> {
36 template <typename I> static void reportMemoryUsage(I, I, MemoryClassInfo&) { }
37 };
38
39 }
40
41 namespace WebCore { 30 namespace WebCore {
42 31
43 static v8::Local<v8::String> makeExternalString(const String& string) 32 static v8::Local<v8::String> makeExternalString(const String& string)
44 { 33 {
45 if (string.is8Bit()) { 34 if (string.is8Bit()) {
46 WebCoreStringResource8* stringResource = new WebCoreStringResource8(stri ng); 35 WebCoreStringResource8* stringResource = new WebCoreStringResource8(stri ng);
47 v8::Local<v8::String> newString = v8::String::NewExternal(stringResource ); 36 v8::Local<v8::String> newString = v8::String::NewExternal(stringResource );
48 if (newString.IsEmpty()) 37 if (newString.IsEmpty())
49 delete stringResource; 38 delete stringResource;
50 return newString; 39 return newString;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 wrapper.MarkIndependent(isolate); 90 wrapper.MarkIndependent(isolate);
102 WeakHandleListener<StringCache, StringImpl>::makeWeak(isolate, wrapper, stri ngImpl); 91 WeakHandleListener<StringCache, StringImpl>::makeWeak(isolate, wrapper, stri ngImpl);
103 m_stringCache.set(stringImpl, wrapper); 92 m_stringCache.set(stringImpl, wrapper);
104 93
105 m_lastStringImpl = stringImpl; 94 m_lastStringImpl = stringImpl;
106 m_lastV8String = wrapper; 95 m_lastV8String = wrapper;
107 96
108 return newString; 97 return newString;
109 } 98 }
110 99
111 void StringCache::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
112 {
113 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::Binding);
114 info.addMember(m_stringCache, "stringCache");
115 info.ignoreMember(m_lastV8String);
116 info.addMember(m_lastStringImpl, "lastStringImpl");
117 }
118
119 IntegerCache::IntegerCache() 100 IntegerCache::IntegerCache()
120 { 101 {
121 v8::HandleScope handleScope; 102 v8::HandleScope handleScope;
122 for (int value = 0; value < numberOfCachedSmallIntegers; value++) 103 for (int value = 0; value < numberOfCachedSmallIntegers; value++)
123 m_smallIntegers[value].set(v8::Integer::New(value)); 104 m_smallIntegers[value].set(v8::Integer::New(value));
124 } 105 }
125 106
126 } // namespace WebCore 107 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/V8ValueCache.h ('k') | Source/core/core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698