OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 auto private_cached_data = | 50 auto private_cached_data = |
51 V8PrivateProperty::GetMessageEventCachedData(isolate); | 51 V8PrivateProperty::GetMessageEventCachedData(isolate); |
52 v8::Local<v8::Value> cached_data = | 52 v8::Local<v8::Value> cached_data = |
53 private_cached_data.GetOrEmpty(info.Holder()); | 53 private_cached_data.GetOrEmpty(info.Holder()); |
54 if (!cached_data.IsEmpty()) { | 54 if (!cached_data.IsEmpty()) { |
55 V8SetReturnValue(info, cached_data); | 55 V8SetReturnValue(info, cached_data); |
56 return; | 56 return; |
57 } | 57 } |
58 | 58 |
59 MessageEvent* event = V8MessageEvent::toImpl(info.Holder()); | 59 MessageEvent* event = V8MessageEvent::toImpl(info.Holder()); |
| 60 ScriptState* script_state = ScriptState::Current(isolate); |
60 | 61 |
61 v8::Local<v8::Value> result; | 62 v8::Local<v8::Value> result; |
62 switch (event->GetDataType()) { | 63 switch (event->GetDataType()) { |
63 case MessageEvent::kDataTypeScriptValue: | 64 case MessageEvent::kDataTypeV8Reference: |
64 result = | 65 result = event->DataAsScriptValue(script_state).V8ValueFor(script_state); |
65 event->DataAsScriptValue().V8ValueFor(ScriptState::Current(isolate)); | |
66 if (result.IsEmpty()) | 66 if (result.IsEmpty()) |
67 result = v8::Null(isolate); | 67 result = v8::Null(isolate); |
68 break; | 68 break; |
69 | 69 |
70 case MessageEvent::kDataTypeSerializedScriptValue: | 70 case MessageEvent::kDataTypeSerializedScriptValue: |
71 if (SerializedScriptValue* serialized_value = | 71 if (SerializedScriptValue* serialized_value = |
72 event->DataAsSerializedScriptValue()) { | 72 event->DataAsSerializedScriptValue()) { |
73 MessagePortArray ports = event->ports(); | 73 MessagePortArray ports = event->ports(); |
74 SerializedScriptValue::DeserializeOptions options; | 74 SerializedScriptValue::DeserializeOptions options; |
75 options.message_ports = &ports; | 75 options.message_ports = &ports; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 if (exception_state.HadException()) | 128 if (exception_state.HadException()) |
129 return; | 129 return; |
130 } | 130 } |
131 event->initMessageEvent( | 131 event->initMessageEvent( |
132 type_arg, can_bubble_arg, cancelable_arg, | 132 type_arg, can_bubble_arg, cancelable_arg, |
133 ScriptValue(ScriptState::Current(info.GetIsolate()), data_arg), | 133 ScriptValue(ScriptState::Current(info.GetIsolate()), data_arg), |
134 origin_arg, last_event_id_arg, source_arg, port_array); | 134 origin_arg, last_event_id_arg, source_arg, port_array); |
135 } | 135 } |
136 | 136 |
137 } // namespace blink | 137 } // namespace blink |
OLD | NEW |