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

Side by Side Diff: Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp

Issue 23819007: Have Node::document() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007-2011 Google Inc. All rights reserved. 2 * Copyright (C) 2007-2011 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 if (args.Length() < 1) 266 if (args.Length() < 1)
267 return; 267 return;
268 268
269 v8::Local<v8::Value> value = args[0]; 269 v8::Local<v8::Value> value = args[0];
270 if (!V8Node::HasInstance(value, args.GetIsolate(), worldType(args.GetIsolate ()))) 270 if (!V8Node::HasInstance(value, args.GetIsolate(), worldType(args.GetIsolate ())))
271 return; 271 return;
272 Node* node = V8Node::toNative(value->ToObject()); 272 Node* node = V8Node::toNative(value->ToObject());
273 if (!node) 273 if (!node)
274 return; 274 return;
275 // This can only happen for orphan DocumentType nodes. 275 // This can only happen for orphan DocumentType nodes.
276 Document* document = node->document(); 276 Document& document = node->document();
277 if (!node->document())
278 return;
279 277
280 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder()); 278 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
281 Vector<EventListenerInfo> listenersArray; 279 Vector<EventListenerInfo> listenersArray;
282 host->getEventListenersImpl(node, listenersArray); 280 host->getEventListenersImpl(node, listenersArray);
283 281
284 v8::Local<v8::Object> result = v8::Object::New(); 282 v8::Local<v8::Object> result = v8::Object::New();
285 for (size_t i = 0; i < listenersArray.size(); ++i) { 283 for (size_t i = 0; i < listenersArray.size(); ++i) {
286 v8::Handle<v8::Array> listeners = getJSListenerFunctions(document, liste nersArray[i]); 284 v8::Handle<v8::Array> listeners = getJSListenerFunctions(&document, list enersArray[i]);
287 if (!listeners->Length()) 285 if (!listeners->Length())
288 continue; 286 continue;
289 AtomicString eventType = listenersArray[i].eventType; 287 AtomicString eventType = listenersArray[i].eventType;
290 result->Set(v8String(eventType, args.GetIsolate()), listeners); 288 result->Set(v8String(eventType, args.GetIsolate()), listeners);
291 } 289 }
292 290
293 v8SetReturnValue(args, result); 291 v8SetReturnValue(args, result);
294 } 292 }
295 293
296 void V8InjectedScriptHost::inspectMethodCustom(const v8::FunctionCallbackInfo<v8 ::Value>& args) 294 void V8InjectedScriptHost::inspectMethodCustom(const v8::FunctionCallbackInfo<v8 ::Value>& args)
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 int lineNumber; 429 int lineNumber;
432 int columnNumber; 430 int columnNumber;
433 if (!getFunctionLocation(args, &scriptId, &lineNumber, &columnNumber)) 431 if (!getFunctionLocation(args, &scriptId, &lineNumber, &columnNumber))
434 return; 432 return;
435 433
436 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder()); 434 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
437 host->unmonitorFunction(scriptId, lineNumber, columnNumber); 435 host->unmonitorFunction(scriptId, lineNumber, columnNumber);
438 } 436 }
439 437
440 } // namespace WebCore 438 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp ('k') | Source/core/accessibility/AXObjectCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698