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

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

Issue 2184113002: [bindings] Use new SetAlignedPointerInInternalFields V8 API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 | 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) 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // value may not be a Blink's wrapper object. In order to make sure of it, 63 // value may not be a Blink's wrapper object. In order to make sure of it,
64 // Use isWrapper function instead. 64 // Use isWrapper function instead.
65 CORE_EXPORT static bool hasInternalFieldsSet(v8::Local<v8::Value>); 65 CORE_EXPORT static bool hasInternalFieldsSet(v8::Local<v8::Value>);
66 }; 66 };
67 67
68 inline void V8DOMWrapper::setNativeInfo(v8::Isolate* isolate, v8::Local<v8::Obje ct> wrapper, const WrapperTypeInfo* wrapperTypeInfo, ScriptWrappable* scriptWrap pable) 68 inline void V8DOMWrapper::setNativeInfo(v8::Isolate* isolate, v8::Local<v8::Obje ct> wrapper, const WrapperTypeInfo* wrapperTypeInfo, ScriptWrappable* scriptWrap pable)
69 { 69 {
70 ASSERT(wrapper->InternalFieldCount() >= 2); 70 ASSERT(wrapper->InternalFieldCount() >= 2);
71 ASSERT(scriptWrappable); 71 ASSERT(scriptWrappable);
72 ASSERT(wrapperTypeInfo); 72 ASSERT(wrapperTypeInfo);
73 wrapper->SetAlignedPointerInInternalField(v8DOMWrapperObjectIndex, scriptWra ppable); 73 int indices[] = { v8DOMWrapperObjectIndex, v8DOMWrapperTypeIndex };
74 wrapper->SetAlignedPointerInInternalField(v8DOMWrapperTypeIndex, const_cast< WrapperTypeInfo*>(wrapperTypeInfo)); 74 void* values[] = { scriptWrappable, const_cast<WrapperTypeInfo*>(wrapperType Info) };
75 wrapper->SetAlignedPointerInInternalFields(2, indices, values);
haraken 2016/08/03 22:59:32 2 => WTF_ARRAY_LENGTH
75 if (RuntimeEnabledFeatures::traceWrappablesEnabled()) { 76 if (RuntimeEnabledFeatures::traceWrappablesEnabled()) {
76 auto perIsolateData = V8PerIsolateData::from(isolate); 77 auto perIsolateData = V8PerIsolateData::from(isolate);
77 // We notify ScriptWrappableVisitor about the new wrapper association, 78 // We notify ScriptWrappableVisitor about the new wrapper association,
78 // so the visitor can make sure to trace the association (in case it is 79 // so the visitor can make sure to trace the association (in case it is
79 // currently tracing). Because of some optimizations, V8 will not 80 // currently tracing). Because of some optimizations, V8 will not
80 // necessarily detect wrappers created during its incremental marking. 81 // necessarily detect wrappers created during its incremental marking.
81 perIsolateData->scriptWrappableVisitor() 82 perIsolateData->scriptWrappableVisitor()
82 ->RegisterV8Reference(std::make_pair( 83 ->RegisterV8Reference(std::make_pair(
83 const_cast<WrapperTypeInfo*>(wrapperTypeInfo), scriptWrappable)) ; 84 const_cast<WrapperTypeInfo*>(wrapperTypeInfo), scriptWrappable)) ;
84 } 85 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 161
161 bool m_didEnterContext; 162 bool m_didEnterContext;
162 v8::Local<v8::Context> m_context; 163 v8::Local<v8::Context> m_context;
163 v8::TryCatch m_tryCatch; 164 v8::TryCatch m_tryCatch;
164 bool m_convertExceptions; 165 bool m_convertExceptions;
165 }; 166 };
166 167
167 } // namespace blink 168 } // namespace blink
168 169
169 #endif // V8DOMWrapper_h 170 #endif // V8DOMWrapper_h
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698