OLD | NEW |
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 25 matching lines...) Expand all Loading... |
36 #include "bindings/core/v8/V8NPObject.h" | 36 #include "bindings/core/v8/V8NPObject.h" |
37 #include "bindings/core/v8/npruntime_impl.h" | 37 #include "bindings/core/v8/npruntime_impl.h" |
38 #include "bindings/core/v8/npruntime_priv.h" | 38 #include "bindings/core/v8/npruntime_priv.h" |
39 #include "core/frame/LocalDOMWindow.h" | 39 #include "core/frame/LocalDOMWindow.h" |
40 #include "wtf/text/WTFString.h" | 40 #include "wtf/text/WTFString.h" |
41 | 41 |
42 #include <stdlib.h> | 42 #include <stdlib.h> |
43 | 43 |
44 namespace blink { | 44 namespace blink { |
45 | 45 |
46 void convertV8ObjectToNPVariant(v8::Local<v8::Value> object, NPObject* owner, NP
Variant* result, v8::Isolate* isolate) | 46 void convertV8ObjectToNPVariant(v8::Isolate* isolate, v8::Local<v8::Value> objec
t, NPObject* owner, NPVariant* result) |
47 { | 47 { |
48 VOID_TO_NPVARIANT(*result); | 48 VOID_TO_NPVARIANT(*result); |
49 | 49 |
50 // It is really the caller's responsibility to deal with the empty handle ca
se because there could be different actions to | 50 // It is really the caller's responsibility to deal with the empty handle ca
se because there could be different actions to |
51 // take in different contexts. | 51 // take in different contexts. |
52 ASSERT(!object.IsEmpty()); | 52 ASSERT(!object.IsEmpty()); |
53 | 53 |
54 if (object.IsEmpty()) | 54 if (object.IsEmpty()) |
55 return; | 55 return; |
56 | 56 |
(...skipping 13 matching lines...) Expand all Loading... |
70 STRINGN_TO_NPVARIANT(utf8Chars, length-1, *result); | 70 STRINGN_TO_NPVARIANT(utf8Chars, length-1, *result); |
71 } else if (object->IsObject()) { | 71 } else if (object->IsObject()) { |
72 LocalDOMWindow* window = currentDOMWindow(isolate); | 72 LocalDOMWindow* window = currentDOMWindow(isolate); |
73 NPObject* npobject = npCreateV8ScriptObject(isolate, 0, v8::Handle<v8::O
bject>::Cast(object), window); | 73 NPObject* npobject = npCreateV8ScriptObject(isolate, 0, v8::Handle<v8::O
bject>::Cast(object), window); |
74 if (npobject) | 74 if (npobject) |
75 _NPN_RegisterObject(npobject, owner); | 75 _NPN_RegisterObject(npobject, owner); |
76 OBJECT_TO_NPVARIANT(npobject, *result); | 76 OBJECT_TO_NPVARIANT(npobject, *result); |
77 } | 77 } |
78 } | 78 } |
79 | 79 |
80 v8::Handle<v8::Value> convertNPVariantToV8Object(const NPVariant* variant, NPObj
ect* owner, v8::Isolate* isolate) | 80 v8::Handle<v8::Value> convertNPVariantToV8Object(v8::Isolate* isolate, const NPV
ariant* variant, NPObject* owner) |
81 { | 81 { |
82 NPVariantType type = variant->type; | 82 NPVariantType type = variant->type; |
83 | 83 |
84 switch (type) { | 84 switch (type) { |
85 case NPVariantType_Int32: | 85 case NPVariantType_Int32: |
86 return v8::Integer::New(isolate, NPVARIANT_TO_INT32(*variant)); | 86 return v8::Integer::New(isolate, NPVARIANT_TO_INT32(*variant)); |
87 case NPVariantType_Double: | 87 case NPVariantType_Double: |
88 return v8::Number::New(isolate, NPVARIANT_TO_DOUBLE(*variant)); | 88 return v8::Number::New(isolate, NPVARIANT_TO_DOUBLE(*variant)); |
89 case NPVariantType_Bool: | 89 case NPVariantType_Bool: |
90 return v8Boolean(NPVARIANT_TO_BOOLEAN(*variant), isolate); | 90 return v8Boolean(NPVARIANT_TO_BOOLEAN(*variant), isolate); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 ExceptionCatcher::~ExceptionCatcher() | 162 ExceptionCatcher::~ExceptionCatcher() |
163 { | 163 { |
164 if (!m_tryCatch.HasCaught()) | 164 if (!m_tryCatch.HasCaught()) |
165 return; | 165 return; |
166 | 166 |
167 if (topHandler) | 167 if (topHandler) |
168 topHandler->handler(topHandler->data, *v8::String::Utf8Value(m_tryCatch.
Exception())); | 168 topHandler->handler(topHandler->data, *v8::String::Utf8Value(m_tryCatch.
Exception())); |
169 } | 169 } |
170 | 170 |
171 } // namespace blink | 171 } // namespace blink |
OLD | NEW |