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

Side by Side Diff: third_party/WebKit/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp

Issue 67141: AtomicString usage improvements in v8 interceptors. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 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 | « third_party/WebKit/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp ('k') | no next file » | 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) 2007, 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 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 30 matching lines...) Expand all
41 41
42 #include <wtf/RefPtr.h> 42 #include <wtf/RefPtr.h>
43 43
44 namespace WebCore { 44 namespace WebCore {
45 45
46 NAMED_PROPERTY_DELETER(HTMLDocument) 46 NAMED_PROPERTY_DELETER(HTMLDocument)
47 { 47 {
48 // Only handle document.all. Insert the marker object into the 48 // Only handle document.all. Insert the marker object into the
49 // shadow internal field to signal that document.all is no longer 49 // shadow internal field to signal that document.all is no longer
50 // shadowed. 50 // shadowed.
51 String key = toWebCoreString(name); 51 AtomicString key = v8StringToAtomicWebCoreString(name);
52 if (key != "all") 52 static const AtomicString all("all");
53 if (key != all)
53 return deletionNotHandledByInterceptor(); 54 return deletionNotHandledByInterceptor();
54 55
55 ASSERT(info.Holder()->InternalFieldCount() == kHTMLDocumentInternalFieldCoun t); 56 ASSERT(info.Holder()->InternalFieldCount() == kHTMLDocumentInternalFieldCoun t);
56 v8::Local<v8::Value> marker = info.Holder()->GetInternalField(kHTMLDocumentM arkerIndex); 57 v8::Local<v8::Value> marker = info.Holder()->GetInternalField(kHTMLDocumentM arkerIndex);
57 info.Holder()->SetInternalField(kHTMLDocumentShadowIndex, marker); 58 info.Holder()->SetInternalField(kHTMLDocumentShadowIndex, marker);
58 return v8::True(); 59 return v8::True();
59 } 60 }
60 61
61 NAMED_PROPERTY_GETTER(HTMLDocument) 62 NAMED_PROPERTY_GETTER(HTMLDocument)
62 { 63 {
63 INC_STATS("DOM.HTMLDocument.NamedPropertyGetter"); 64 INC_STATS("DOM.HTMLDocument.NamedPropertyGetter");
64 AtomicString key = toWebCoreString(name); 65 AtomicString key = v8StringToAtomicWebCoreString(name);
65 66
66 // Special case for document.all. If the value in the shadow 67 // Special case for document.all. If the value in the shadow
67 // internal field is not the marker object, then document.all has 68 // internal field is not the marker object, then document.all has
68 // been temporarily shadowed and we return the value. 69 // been temporarily shadowed and we return the value.
69 if (key == "all") { 70 static const AtomicString all("all");
71 if (key == all) {
70 ASSERT(info.Holder()->InternalFieldCount() == kHTMLDocumentInternalField Count); 72 ASSERT(info.Holder()->InternalFieldCount() == kHTMLDocumentInternalField Count);
71 v8::Local<v8::Value> marker = info.Holder()->GetInternalField(kHTMLDocum entMarkerIndex); 73 v8::Local<v8::Value> marker = info.Holder()->GetInternalField(kHTMLDocum entMarkerIndex);
72 v8::Local<v8::Value> value = info.Holder()->GetInternalField(kHTMLDocume ntShadowIndex); 74 v8::Local<v8::Value> value = info.Holder()->GetInternalField(kHTMLDocume ntShadowIndex);
73 if (marker != value) 75 if (marker != value)
74 return value; 76 return value;
75 } 77 }
76 78
77 HTMLDocument* htmlDocument = V8Proxy::DOMWrapperToNode<HTMLDocument>(info.Ho lder()); 79 HTMLDocument* htmlDocument = V8Proxy::DOMWrapperToNode<HTMLDocument>(info.Ho lder());
78 80
79 // Fast case for named elements that are not there. 81 // Fast case for named elements that are not there.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 184
183 ACCESSOR_SETTER(HTMLDocumentAll) 185 ACCESSOR_SETTER(HTMLDocumentAll)
184 { 186 {
185 INC_STATS("DOM.HTMLDocument.all._set"); 187 INC_STATS("DOM.HTMLDocument.all._set");
186 v8::Handle<v8::Object> holder = info.Holder(); 188 v8::Handle<v8::Object> holder = info.Holder();
187 ASSERT(info.Holder()->InternalFieldCount() == kHTMLDocumentInternalFieldCoun t); 189 ASSERT(info.Holder()->InternalFieldCount() == kHTMLDocumentInternalFieldCoun t);
188 info.Holder()->SetInternalField(kHTMLDocumentShadowIndex, value); 190 info.Holder()->SetInternalField(kHTMLDocumentShadowIndex, value);
189 } 191 }
190 192
191 } // namespace WebCore 193 } // namespace WebCore
OLDNEW
« no previous file with comments | « third_party/WebKit/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698