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

Side by Side Diff: webkit/port/bindings/v8/v8_nodefilter.cpp

Issue 9019: Make ExceptionContext platform-independent using magic headers (2/2) (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 1 month 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 | « webkit/port/bindings/v8/v8_custom.cpp ('k') | webkit/port/bridge/ExceptionContextV8.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 // Copyright (c) 2008, Google Inc. 1 // Copyright (c) 2008, Google Inc.
2 // All rights reserved. 2 // 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 m_filter.Dispose(); 51 m_filter.Dispose();
52 m_filter.Clear(); 52 m_filter.Clear();
53 } 53 }
54 54
55 short V8NodeFilterCondition::acceptNode(ExceptionContext* exception_context, 55 short V8NodeFilterCondition::acceptNode(ExceptionContext* exception_context,
56 Node* node) const { 56 Node* node) const {
57 ASSERT(v8::Context::InContext()); 57 ASSERT(v8::Context::InContext());
58 58
59 if (!m_filter->IsFunction()) return NodeFilter::FILTER_ACCEPT; 59 if (!m_filter->IsFunction()) return NodeFilter::FILTER_ACCEPT;
60 60
61 ExceptionCatcher exception_catcher(exception_context); 61 v8::TryCatch exception_catcher;
62 62
63 v8::Handle<v8::Object> this_obj = v8::Context::GetCurrent()->Global(); 63 v8::Handle<v8::Object> this_obj = v8::Context::GetCurrent()->Global();
64 v8::Handle<v8::Function> callback = 64 v8::Handle<v8::Function> callback =
65 v8::Handle<v8::Function>::Cast(m_filter); 65 v8::Handle<v8::Function>::Cast(m_filter);
66 v8::Handle<v8::Value>* args = new v8::Handle<v8::Value>[1]; 66 v8::Handle<v8::Value>* args = new v8::Handle<v8::Value>[1];
67 args[0] = V8Proxy::ToV8Object(V8ClassIndex::NODE, node); 67 args[0] = V8Proxy::ToV8Object(V8ClassIndex::NODE, node);
68 68
69 V8Proxy* proxy = V8Proxy::retrieve(); 69 V8Proxy* proxy = V8Proxy::retrieve();
70 ASSERT(proxy); 70 ASSERT(proxy);
71 71
72 v8::Handle<v8::Value> result = 72 v8::Handle<v8::Value> result =
73 proxy->CallFunction(callback, this_obj, 1, args); 73 proxy->CallFunction(callback, this_obj, 1, args);
74 delete[] args; 74 delete[] args;
75 75
76 if (exception_context->hadException()) { 76 if (exception_catcher.HasCaught()) {
77 exception_context->setData(exception_catcher.Exception());
77 return NodeFilter::FILTER_REJECT; 78 return NodeFilter::FILTER_REJECT;
78 } 79 }
79 80
80 ASSERT(!result.IsEmpty()); 81 ASSERT(!result.IsEmpty());
81 82
82 return result->Int32Value(); 83 return result->Int32Value();
83 } 84 }
84 85
85 } // namespace WebCore 86 } // namespace WebCore
OLDNEW
« no previous file with comments | « webkit/port/bindings/v8/v8_custom.cpp ('k') | webkit/port/bridge/ExceptionContextV8.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698