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

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

Issue 23993004: Have convertNPVariantToV8Object() use the isolate it is given (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
« no previous file with comments | « Source/bindings/v8/V8NPObject.cpp ('k') | 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) 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 } 76 }
77 77
78 v8::Handle<v8::Value> convertNPVariantToV8Object(const NPVariant* variant, NPObj ect* owner, v8::Isolate* isolate) 78 v8::Handle<v8::Value> convertNPVariantToV8Object(const NPVariant* variant, NPObj ect* owner, v8::Isolate* isolate)
79 { 79 {
80 NPVariantType type = variant->type; 80 NPVariantType type = variant->type;
81 81
82 switch (type) { 82 switch (type) {
83 case NPVariantType_Int32: 83 case NPVariantType_Int32:
84 return v8::Integer::New(NPVARIANT_TO_INT32(*variant), isolate); 84 return v8::Integer::New(NPVARIANT_TO_INT32(*variant), isolate);
85 case NPVariantType_Double: 85 case NPVariantType_Double:
86 return v8::Number::New(NPVARIANT_TO_DOUBLE(*variant)); 86 return v8::Number::New(isolate, NPVARIANT_TO_DOUBLE(*variant));
87 case NPVariantType_Bool: 87 case NPVariantType_Bool:
88 return v8Boolean(NPVARIANT_TO_BOOLEAN(*variant)); 88 return v8Boolean(NPVARIANT_TO_BOOLEAN(*variant), isolate);
89 case NPVariantType_Null: 89 case NPVariantType_Null:
90 return v8::Null(); 90 return v8::Null(isolate);
91 case NPVariantType_Void: 91 case NPVariantType_Void:
92 return v8::Undefined(); 92 return v8::Undefined(isolate);
93 case NPVariantType_String: { 93 case NPVariantType_String: {
94 NPString src = NPVARIANT_TO_STRING(*variant); 94 NPString src = NPVARIANT_TO_STRING(*variant);
95 return v8::String::New(src.UTF8Characters, src.UTF8Length); 95 return v8::String::New(src.UTF8Characters, src.UTF8Length);
96 } 96 }
97 case NPVariantType_Object: { 97 case NPVariantType_Object: {
98 NPObject* object = NPVARIANT_TO_OBJECT(*variant); 98 NPObject* object = NPVARIANT_TO_OBJECT(*variant);
99 if (V8NPObject* v8Object = npObjectToV8NPObject(object)) 99 if (V8NPObject* v8Object = npObjectToV8NPObject(object))
100 return v8::Local<v8::Object>::New(isolate, v8Object->v8Object); 100 return v8::Local<v8::Object>::New(isolate, v8Object->v8Object);
101 return createV8ObjectForNPObject(object, owner); 101 return createV8ObjectForNPObject(object, owner, isolate);
102 } 102 }
103 default: 103 default:
104 return v8::Undefined(); 104 return v8::Undefined(isolate);
105 } 105 }
106 } 106 }
107 107
108 // Helper function to create an NPN String Identifier from a v8 string. 108 // Helper function to create an NPN String Identifier from a v8 string.
109 NPIdentifier getStringIdentifier(v8::Handle<v8::String> str) 109 NPIdentifier getStringIdentifier(v8::Handle<v8::String> str)
110 { 110 {
111 const int kStackBufferSize = 100; 111 const int kStackBufferSize = 100;
112 112
113 int bufferLength = str->Utf8Length() + 1; 113 int bufferLength = str->Utf8Length() + 1;
114 if (bufferLength <= kStackBufferSize) { 114 if (bufferLength <= kStackBufferSize) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 ExceptionCatcher::~ExceptionCatcher() 160 ExceptionCatcher::~ExceptionCatcher()
161 { 161 {
162 if (!m_tryCatch.HasCaught()) 162 if (!m_tryCatch.HasCaught())
163 return; 163 return;
164 164
165 if (topHandler) 165 if (topHandler)
166 topHandler->handler(topHandler->data, *v8::String::Utf8Value(m_tryCatch. Exception())); 166 topHandler->handler(topHandler->data, *v8::String::Utf8Value(m_tryCatch. Exception()));
167 } 167 }
168 168
169 } // namespace WebCore 169 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/V8NPObject.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698