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

Side by Side Diff: Source/WebKit/chromium/src/WebBindings.cpp

Issue 24715003: [oilpan] Fix NPObject bindings by not using HandleScopes in WebBindings for non-webcore specific me… (Closed) Base URL: svn://svn.chromium.org/blink/branches/oilpan
Patch Set: Address review comment. Created 7 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 | Annotate | Revision Log
« 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 namespace WebKit { 56 namespace WebKit {
57 57
58 bool WebBindings::construct(NPP npp, NPObject* object, const NPVariant* args, ui nt32_t argCount, NPVariant* result) 58 bool WebBindings::construct(NPP npp, NPObject* object, const NPVariant* args, ui nt32_t argCount, NPVariant* result)
59 { 59 {
60 HandleScope scope; 60 HandleScope scope;
61 return _NPN_Construct(npp, object, args, argCount, result); 61 return _NPN_Construct(npp, object, args, argCount, result);
62 } 62 }
63 63
64 NPObject* WebBindings::createObject(NPP npp, NPClass* npClass) 64 NPObject* WebBindings::createObject(NPP npp, NPClass* npClass)
65 { 65 {
66 HandleScope scope; 66 // WebCore independent method that is called from non-WebCore related
67 // threads. Therefore there is no HandleScope nor NoHandleScope here.
67 return _NPN_CreateObject(npp, npClass); 68 return _NPN_CreateObject(npp, npClass);
68 } 69 }
69 70
70 bool WebBindings::enumerate(NPP npp, NPObject* object, NPIdentifier** identifier , uint32_t* identifierCount) 71 bool WebBindings::enumerate(NPP npp, NPObject* object, NPIdentifier** identifier , uint32_t* identifierCount)
71 { 72 {
72 HandleScope scope; 73 HandleScope scope;
73 return _NPN_Enumerate(npp, object, identifier, identifierCount); 74 return _NPN_Enumerate(npp, object, identifier, identifierCount);
74 } 75 }
75 76
76 bool WebBindings::evaluate(NPP npp, NPObject* object, NPString* script, NPVarian t* result) 77 bool WebBindings::evaluate(NPP npp, NPObject* object, NPString* script, NPVarian t* result)
77 { 78 {
78 HandleScope scope; 79 HandleScope scope;
79 return _NPN_Evaluate(npp, object, script, result); 80 return _NPN_Evaluate(npp, object, script, result);
80 } 81 }
81 82
82 bool WebBindings::evaluateHelper(NPP npp, bool popupsAllowed, NPObject* object, NPString* script, NPVariant* result) 83 bool WebBindings::evaluateHelper(NPP npp, bool popupsAllowed, NPObject* object, NPString* script, NPVariant* result)
83 { 84 {
84 HandleScope scope; 85 HandleScope scope;
85 return _NPN_EvaluateHelper(npp, popupsAllowed, object, script, result); 86 return _NPN_EvaluateHelper(npp, popupsAllowed, object, script, result);
86 } 87 }
87 88
88 NPIdentifier WebBindings::getIntIdentifier(int32_t number) 89 NPIdentifier WebBindings::getIntIdentifier(int32_t number)
89 { 90 {
90 HandleScope scope; 91 // WebCore independent method that is called from non-WebCore related
92 // threads. Therefore there is no HandleScope nor NoHandleScope here.
91 return _NPN_GetIntIdentifier(number); 93 return _NPN_GetIntIdentifier(number);
92 } 94 }
93 95
94 bool WebBindings::getProperty(NPP npp, NPObject* object, NPIdentifier property, NPVariant* result) 96 bool WebBindings::getProperty(NPP npp, NPObject* object, NPIdentifier property, NPVariant* result)
95 { 97 {
96 HandleScope scope; 98 HandleScope scope;
97 return _NPN_GetProperty(npp, object, property, result); 99 return _NPN_GetProperty(npp, object, property, result);
98 } 100 }
99 101
100 NPIdentifier WebBindings::getStringIdentifier(const NPUTF8* string) 102 NPIdentifier WebBindings::getStringIdentifier(const NPUTF8* string)
101 { 103 {
102 HandleScope scope; 104 // WebCore independent method that is called from non-WebCore related
105 // threads. Therefore there is no HandleScope nor NoHandleScope here.
103 return _NPN_GetStringIdentifier(string); 106 return _NPN_GetStringIdentifier(string);
104 } 107 }
105 108
106 void WebBindings::getStringIdentifiers(const NPUTF8** names, int32_t nameCount, NPIdentifier* identifiers) 109 void WebBindings::getStringIdentifiers(const NPUTF8** names, int32_t nameCount, NPIdentifier* identifiers)
107 { 110 {
108 HandleScope scope; 111 // WebCore independent method that is called from non-WebCore related
112 // threads. Therefore there is no HandleScope nor NoHandleScope here.
109 _NPN_GetStringIdentifiers(names, nameCount, identifiers); 113 _NPN_GetStringIdentifiers(names, nameCount, identifiers);
110 } 114 }
111 115
112 bool WebBindings::hasMethod(NPP npp, NPObject* object, NPIdentifier method) 116 bool WebBindings::hasMethod(NPP npp, NPObject* object, NPIdentifier method)
113 { 117 {
114 HandleScope scope; 118 HandleScope scope;
115 return _NPN_HasMethod(npp, object, method); 119 return _NPN_HasMethod(npp, object, method);
116 } 120 }
117 121
118 bool WebBindings::hasProperty(NPP npp, NPObject* object, NPIdentifier property) 122 bool WebBindings::hasProperty(NPP npp, NPObject* object, NPIdentifier property)
119 { 123 {
120 HandleScope scope; 124 HandleScope scope;
121 return _NPN_HasProperty(npp, object, property); 125 return _NPN_HasProperty(npp, object, property);
122 } 126 }
123 127
124 bool WebBindings::identifierIsString(NPIdentifier identifier) 128 bool WebBindings::identifierIsString(NPIdentifier identifier)
125 { 129 {
126 HandleScope scope; 130 // WebCore independent method that is called from non-WebCore related
131 // threads. Therefore there is no HandleScope nor NoHandleScope here.
127 return _NPN_IdentifierIsString(identifier); 132 return _NPN_IdentifierIsString(identifier);
128 } 133 }
129 134
130 int32_t WebBindings::intFromIdentifier(NPIdentifier identifier) 135 int32_t WebBindings::intFromIdentifier(NPIdentifier identifier)
131 { 136 {
132 HandleScope scope; 137 // WebCore independent method that is called from non-WebCore related
138 // threads. Therefore there is no HandleScope nor NoHandleScope here.
133 return _NPN_IntFromIdentifier(identifier); 139 return _NPN_IntFromIdentifier(identifier);
134 } 140 }
135 141
136 void WebBindings::initializeVariantWithStringCopy(NPVariant* variant, const NPSt ring* value) 142 void WebBindings::initializeVariantWithStringCopy(NPVariant* variant, const NPSt ring* value)
137 { 143 {
138 HandleScope scope; 144 // WebCore independent method that is called from non-WebCore related
145 // threads. Therefore there is no HandleScope nor NoHandleScope here.
139 _NPN_InitializeVariantWithStringCopy(variant, value); 146 _NPN_InitializeVariantWithStringCopy(variant, value);
140 } 147 }
141 148
142 bool WebBindings::invoke(NPP npp, NPObject* object, NPIdentifier method, const N PVariant* args, uint32_t argCount, NPVariant* result) 149 bool WebBindings::invoke(NPP npp, NPObject* object, NPIdentifier method, const N PVariant* args, uint32_t argCount, NPVariant* result)
143 { 150 {
144 HandleScope scope; 151 HandleScope scope;
145 return _NPN_Invoke(npp, object, method, args, argCount, result); 152 return _NPN_Invoke(npp, object, method, args, argCount, result);
146 } 153 }
147 154
148 bool WebBindings::invokeDefault(NPP npp, NPObject* object, const NPVariant* args , uint32_t argCount, NPVariant* result) 155 bool WebBindings::invokeDefault(NPP npp, NPObject* object, const NPVariant* args , uint32_t argCount, NPVariant* result)
149 { 156 {
150 HandleScope scope; 157 HandleScope scope;
151 return _NPN_InvokeDefault(npp, object, args, argCount, result); 158 return _NPN_InvokeDefault(npp, object, args, argCount, result);
152 } 159 }
153 160
154 void WebBindings::releaseObject(NPObject* object) 161 void WebBindings::releaseObject(NPObject* object)
155 { 162 {
156 HandleScope scope; 163 // WebCore independent method that is called from non-WebCore related
164 // threads. Therefore there is no HandleScope nor NoHandleScope here.
157 return _NPN_ReleaseObject(object); 165 return _NPN_ReleaseObject(object);
158 } 166 }
159 167
160 void WebBindings::releaseVariantValue(NPVariant* variant) 168 void WebBindings::releaseVariantValue(NPVariant* variant)
161 { 169 {
162 HandleScope scope; 170 // WebCore independent method that is called from non-WebCore related
171 // threads. Therefore there is no HandleScope nor NoHandleScope here.
163 _NPN_ReleaseVariantValue(variant); 172 _NPN_ReleaseVariantValue(variant);
164 } 173 }
165 174
166 bool WebBindings::removeProperty(NPP npp, NPObject* object, NPIdentifier identif ier) 175 bool WebBindings::removeProperty(NPP npp, NPObject* object, NPIdentifier identif ier)
167 { 176 {
168 HandleScope scope; 177 HandleScope scope;
169 return _NPN_RemoveProperty(npp, object, identifier); 178 return _NPN_RemoveProperty(npp, object, identifier);
170 } 179 }
171 180
172 NPObject* WebBindings::retainObject(NPObject* object) 181 NPObject* WebBindings::retainObject(NPObject* object)
173 { 182 {
174 HandleScope scope; 183 // WebCore independent method that is called from non-WebCore related
184 // threads. Therefore there is no HandleScope nor NoHandleScope here.
175 return _NPN_RetainObject(object); 185 return _NPN_RetainObject(object);
176 } 186 }
177 187
178 void WebBindings::setException(NPObject* object, const NPUTF8* message) 188 void WebBindings::setException(NPObject* object, const NPUTF8* message)
179 { 189 {
180 HandleScope scope; 190 HandleScope scope;
181 _NPN_SetException(object, message); 191 _NPN_SetException(object, message);
182 } 192 }
183 193
184 bool WebBindings::setProperty(NPP npp, NPObject* object, NPIdentifier identifier , const NPVariant* value) 194 bool WebBindings::setProperty(NPP npp, NPObject* object, NPIdentifier identifier , const NPVariant* value)
185 { 195 {
186 HandleScope scope; 196 HandleScope scope;
187 return _NPN_SetProperty(npp, object, identifier, value); 197 return _NPN_SetProperty(npp, object, identifier, value);
188 } 198 }
189 199
190 void WebBindings::unregisterObject(NPObject* object) 200 void WebBindings::unregisterObject(NPObject* object)
191 { 201 {
192 HandleScope scope; 202 // WebCore independent method that is called from non-WebCore related
203 // threads. Therefore there is no HandleScope nor NoHandleScope here.
193 _NPN_UnregisterObject(object); 204 _NPN_UnregisterObject(object);
194 } 205 }
195 206
196 NPUTF8* WebBindings::utf8FromIdentifier(NPIdentifier identifier) 207 NPUTF8* WebBindings::utf8FromIdentifier(NPIdentifier identifier)
197 { 208 {
198 HandleScope scope; 209 // WebCore independent method that is called from non-WebCore related
210 // threads. Therefore there is no HandleScope nor NoHandleScope here.
199 return _NPN_UTF8FromIdentifier(identifier); 211 return _NPN_UTF8FromIdentifier(identifier);
200 } 212 }
201 213
202 void WebBindings::extractIdentifierData(const NPIdentifier& identifier, const NP UTF8*& string, int32_t& number, bool& isString) 214 void WebBindings::extractIdentifierData(const NPIdentifier& identifier, const NP UTF8*& string, int32_t& number, bool& isString)
203 { 215 {
204 HandleScope scope; 216 // WebCore independent method that is called from non-WebCore related
217 // threads. Therefore there is no HandleScope nor NoHandleScope here.
205 PrivateIdentifier* data = static_cast<PrivateIdentifier*>(identifier); 218 PrivateIdentifier* data = static_cast<PrivateIdentifier*>(identifier);
206 if (!data) { 219 if (!data) {
207 isString = false; 220 isString = false;
208 number = 0; 221 number = 0;
209 return; 222 return;
210 } 223 }
211 224
212 isString = data->isString; 225 isString = data->isString;
213 if (isString) 226 if (isString)
214 string = data->value.string; 227 string = data->value.string;
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 return v8::Undefined(); 404 return v8::Undefined();
392 V8NPObject* v8Object = reinterpret_cast<V8NPObject*>(object); 405 V8NPObject* v8Object = reinterpret_cast<V8NPObject*>(object);
393 return convertNPVariantToV8Object(variant, v8Object->rootObject->frame() ->script()->windowScriptNPObject(), isolate); 406 return convertNPVariantToV8Object(variant, v8Object->rootObject->frame() ->script()->windowScriptNPObject(), isolate);
394 } 407 }
395 // Safe to pass 0 since we have checked the script object class to make sure the 408 // Safe to pass 0 since we have checked the script object class to make sure the
396 // argument is a primitive v8 type. 409 // argument is a primitive v8 type.
397 return convertNPVariantToV8Object(variant, 0, isolate); 410 return convertNPVariantToV8Object(variant, 0, isolate);
398 } 411 }
399 412
400 } // namespace WebKit 413 } // namespace WebKit
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