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

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

Issue 165443003: Pass implementation object to supplemental classes by reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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-2009 Google Inc. All rights reserved. 2 * Copyright (C) 2007-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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 #include "core/xml/DocumentXPathEvaluator.h" 54 #include "core/xml/DocumentXPathEvaluator.h"
55 #include "core/xml/XPathNSResolver.h" 55 #include "core/xml/XPathNSResolver.h"
56 #include "core/xml/XPathResult.h" 56 #include "core/xml/XPathResult.h"
57 #include "wtf/RefPtr.h" 57 #include "wtf/RefPtr.h"
58 58
59 namespace WebCore { 59 namespace WebCore {
60 60
61 void V8Document::evaluateMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info) 61 void V8Document::evaluateMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
62 { 62 {
63 RefPtr<Document> document = V8Document::toNative(info.Holder()); 63 RefPtr<Document> document = V8Document::toNative(info.Holder());
64 ASSERT(document);
64 ExceptionState exceptionState(ExceptionState::ExecutionContext, "evaluate", "Document", info.Holder(), info.GetIsolate()); 65 ExceptionState exceptionState(ExceptionState::ExecutionContext, "evaluate", "Document", info.Holder(), info.GetIsolate());
65 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, expression, info[0] ); 66 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, expression, info[0] );
66 RefPtr<Node> contextNode; 67 RefPtr<Node> contextNode;
67 if (V8Node::hasInstance(info[1], info.GetIsolate())) 68 if (V8Node::hasInstance(info[1], info.GetIsolate()))
68 contextNode = V8Node::toNative(v8::Handle<v8::Object>::Cast(info[1])); 69 contextNode = V8Node::toNative(v8::Handle<v8::Object>::Cast(info[1]));
69 70
70 const int resolverArgumentIndex = 2; 71 const int resolverArgumentIndex = 2;
71 RefPtr<XPathNSResolver> resolver = toXPathNSResolver(info[resolverArgumentIn dex], info.GetIsolate()); 72 RefPtr<XPathNSResolver> resolver = toXPathNSResolver(info[resolverArgumentIn dex], info.GetIsolate());
72 if (!resolver && !isUndefinedOrNull(info[resolverArgumentIndex])) { 73 if (!resolver && !isUndefinedOrNull(info[resolverArgumentIndex])) {
73 exceptionState.throwTypeError(ExceptionMessages::incorrectArgumentType(r esolverArgumentIndex + 1, "is not a resolver function.")); 74 exceptionState.throwTypeError(ExceptionMessages::incorrectArgumentType(r esolverArgumentIndex + 1, "is not a resolver function."));
74 exceptionState.throwIfNeeded(); 75 exceptionState.throwIfNeeded();
75 return; 76 return;
76 } 77 }
77 78
78 int type = toInt32(info[3]); 79 int type = toInt32(info[3]);
79 RefPtr<XPathResult> inResult; 80 RefPtr<XPathResult> inResult;
80 if (V8XPathResult::hasInstance(info[4], info.GetIsolate())) 81 if (V8XPathResult::hasInstance(info[4], info.GetIsolate()))
81 inResult = V8XPathResult::toNative(v8::Handle<v8::Object>::Cast(info[4]) ); 82 inResult = V8XPathResult::toNative(v8::Handle<v8::Object>::Cast(info[4]) );
82 83
83 V8TRYCATCH_VOID(RefPtr<XPathResult>, result, DocumentXPathEvaluator::evaluat e(document.get(), expression, contextNode.get(), resolver.release(), type, inRes ult.get(), exceptionState)); 84 V8TRYCATCH_VOID(RefPtr<XPathResult>, result, DocumentXPathEvaluator::evaluat e(*document, expression, contextNode.get(), resolver.release(), type, inResult.g et(), exceptionState));
84 if (exceptionState.throwIfNeeded()) 85 if (exceptionState.throwIfNeeded())
85 return; 86 return;
86 87
87 v8SetReturnValueFast(info, result.release(), document.get()); 88 v8SetReturnValueFast(info, result.release(), document.get());
88 } 89 }
89 90
90 } // namespace WebCore 91 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestInterfacePython.cpp ('k') | Source/bindings/v8/custom/V8WindowCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698