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

Side by Side Diff: Source/bindings/v8/V8NodeFilterCondition.cpp

Issue 297513008: Decrease call sites of ScriptState::current() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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 | « Source/bindings/v8/V8NodeFilterCondition.h ('k') | Source/bindings/v8/V8WindowShell.cpp » ('j') | 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) 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 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 22 matching lines...) Expand all
33 33
34 #include "V8Node.h" 34 #include "V8Node.h"
35 #include "bindings/v8/ScriptController.h" 35 #include "bindings/v8/ScriptController.h"
36 #include "bindings/v8/V8HiddenValue.h" 36 #include "bindings/v8/V8HiddenValue.h"
37 #include "core/dom/Node.h" 37 #include "core/dom/Node.h"
38 #include "core/dom/NodeFilter.h" 38 #include "core/dom/NodeFilter.h"
39 #include "wtf/OwnPtr.h" 39 #include "wtf/OwnPtr.h"
40 40
41 namespace WebCore { 41 namespace WebCore {
42 42
43 V8NodeFilterCondition::V8NodeFilterCondition(v8::Handle<v8::Value> filter, v8::H andle<v8::Object> owner, v8::Isolate* isolate) 43 V8NodeFilterCondition::V8NodeFilterCondition(v8::Handle<v8::Value> filter, v8::H andle<v8::Object> owner, ScriptState* scriptState)
44 : m_scriptState(ScriptState::current(isolate)) 44 : m_scriptState(scriptState)
45 { 45 {
46 // ..acceptNode(..) will only dispatch m_filter if m_filter->IsObject(). 46 // ..acceptNode(..) will only dispatch m_filter if m_filter->IsObject().
47 // We'll make sure m_filter is either usable by acceptNode or empty. 47 // We'll make sure m_filter is either usable by acceptNode or empty.
48 // (See the fast/dom/node-filter-gc test for a case where 'empty' happens.) 48 // (See the fast/dom/node-filter-gc test for a case where 'empty' happens.)
49 if (!filter.IsEmpty() && filter->IsObject()) { 49 if (!filter.IsEmpty() && filter->IsObject()) {
50 V8HiddenValue::setHiddenValue(isolate, owner, V8HiddenValue::condition(i solate), filter); 50 V8HiddenValue::setHiddenValue(scriptState->isolate(), owner, V8HiddenVal ue::condition(scriptState->isolate()), filter);
51 m_filter.set(isolate, filter); 51 m_filter.set(scriptState->isolate(), filter);
52 m_filter.setWeak(this, &setWeakCallback); 52 m_filter.setWeak(this, &setWeakCallback);
53 } 53 }
54 } 54 }
55 55
56 V8NodeFilterCondition::~V8NodeFilterCondition() 56 V8NodeFilterCondition::~V8NodeFilterCondition()
57 { 57 {
58 } 58 }
59 59
60 short V8NodeFilterCondition::acceptNode(Node* node, ExceptionState& exceptionSta te) const 60 short V8NodeFilterCondition::acceptNode(Node* node, ExceptionState& exceptionSta te) const
61 { 61 {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 return result->Int32Value(); 98 return result->Int32Value();
99 } 99 }
100 100
101 void V8NodeFilterCondition::setWeakCallback(const v8::WeakCallbackData<v8::Value , V8NodeFilterCondition>& data) 101 void V8NodeFilterCondition::setWeakCallback(const v8::WeakCallbackData<v8::Value , V8NodeFilterCondition>& data)
102 { 102 {
103 data.GetParameter()->m_filter.clear(); 103 data.GetParameter()->m_filter.clear();
104 } 104 }
105 105
106 } // namespace WebCore 106 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/V8NodeFilterCondition.h ('k') | Source/bindings/v8/V8WindowShell.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698