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

Side by Side Diff: Source/bindings/core/v8/custom/V8MessageEventCustom.cpp

Issue 1074683002: [bindings] Use Local<> instead of Handle<> (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 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
OLDNEW
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 29 matching lines...) Expand all
40 #include "bindings/core/v8/V8MessagePort.h" 40 #include "bindings/core/v8/V8MessagePort.h"
41 #include "bindings/core/v8/V8Window.h" 41 #include "bindings/core/v8/V8Window.h"
42 #include "core/events/MessageEvent.h" 42 #include "core/events/MessageEvent.h"
43 43
44 namespace blink { 44 namespace blink {
45 45
46 void V8MessageEvent::dataAttributeGetterCustom(const v8::PropertyCallbackInfo<v8 ::Value>& info) 46 void V8MessageEvent::dataAttributeGetterCustom(const v8::PropertyCallbackInfo<v8 ::Value>& info)
47 { 47 {
48 MessageEvent* event = V8MessageEvent::toImpl(info.Holder()); 48 MessageEvent* event = V8MessageEvent::toImpl(info.Holder());
49 49
50 v8::Handle<v8::Value> result; 50 v8::Local<v8::Value> result;
51 switch (event->dataType()) { 51 switch (event->dataType()) {
52 case MessageEvent::DataTypeScriptValue: { 52 case MessageEvent::DataTypeScriptValue: {
53 result = V8HiddenValue::getHiddenValue(info.GetIsolate(), info.Holder(), V8HiddenValue::data(info.GetIsolate())); 53 result = V8HiddenValue::getHiddenValue(info.GetIsolate(), info.Holder(), V8HiddenValue::data(info.GetIsolate()));
54 if (result.IsEmpty()) { 54 if (result.IsEmpty()) {
55 if (!event->dataAsSerializedScriptValue()) { 55 if (!event->dataAsSerializedScriptValue()) {
56 // If we're in an isolated world and the event was created in th e main world, 56 // If we're in an isolated world and the event was created in th e main world,
57 // we need to find the 'data' property on the main world wrapper and clone it. 57 // we need to find the 'data' property on the main world wrapper and clone it.
58 v8::Local<v8::Value> mainWorldData = V8HiddenValue::getHiddenVal ueFromMainWorldWrapper(info.GetIsolate(), event, V8HiddenValue::data(info.GetIso late())); 58 v8::Local<v8::Value> mainWorldData = V8HiddenValue::getHiddenVal ueFromMainWorldWrapper(info.GetIsolate(), event, V8HiddenValue::data(info.GetIso late()));
59 if (!mainWorldData.IsEmpty()) 59 if (!mainWorldData.IsEmpty())
60 event->setSerializedData(SerializedScriptValueFactory::insta nce().createAndSwallowExceptions(info.GetIsolate(), mainWorldData)); 60 event->setSerializedData(SerializedScriptValueFactory::insta nce().createAndSwallowExceptions(info.GetIsolate(), mainWorldData));
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 v8SetReturnValue(info, result); 106 v8SetReturnValue(info, result);
107 } 107 }
108 108
109 void V8MessageEvent::initMessageEventMethodCustom(const v8::FunctionCallbackInfo <v8::Value>& info) 109 void V8MessageEvent::initMessageEventMethodCustom(const v8::FunctionCallbackInfo <v8::Value>& info)
110 { 110 {
111 ExceptionState exceptionState(ExceptionState::ExecutionContext, "initMessage Event", "MessageEvent", info.Holder(), info.GetIsolate()); 111 ExceptionState exceptionState(ExceptionState::ExecutionContext, "initMessage Event", "MessageEvent", info.Holder(), info.GetIsolate());
112 MessageEvent* event = V8MessageEvent::toImpl(info.Holder()); 112 MessageEvent* event = V8MessageEvent::toImpl(info.Holder());
113 TOSTRING_VOID(V8StringResource<>, typeArg, info[0]); 113 TOSTRING_VOID(V8StringResource<>, typeArg, info[0]);
114 TONATIVE_VOID(bool, canBubbleArg, info[1]->BooleanValue()); 114 TONATIVE_VOID(bool, canBubbleArg, info[1]->BooleanValue());
115 TONATIVE_VOID(bool, cancelableArg, info[2]->BooleanValue()); 115 TONATIVE_VOID(bool, cancelableArg, info[2]->BooleanValue());
116 v8::Handle<v8::Value> dataArg = info[3]; 116 v8::Local<v8::Value> dataArg = info[3];
117 TOSTRING_VOID(V8StringResource<>, originArg, info[4]); 117 TOSTRING_VOID(V8StringResource<>, originArg, info[4]);
118 TOSTRING_VOID(V8StringResource<>, lastEventIdArg, info[5]); 118 TOSTRING_VOID(V8StringResource<>, lastEventIdArg, info[5]);
119 DOMWindow* sourceArg = toDOMWindow(info.GetIsolate(), info[6]); 119 DOMWindow* sourceArg = toDOMWindow(info.GetIsolate(), info[6]);
120 OwnPtrWillBeRawPtr<MessagePortArray> portArray = nullptr; 120 OwnPtrWillBeRawPtr<MessagePortArray> portArray = nullptr;
121 const int portArrayIndex = 7; 121 const int portArrayIndex = 7;
122 if (!isUndefinedOrNull(info[portArrayIndex])) { 122 if (!isUndefinedOrNull(info[portArrayIndex])) {
123 portArray = adoptPtrWillBeNoop(new MessagePortArray); 123 portArray = adoptPtrWillBeNoop(new MessagePortArray);
124 *portArray = toRefPtrWillBeMemberNativeArray<MessagePort, V8MessagePort> (info[portArrayIndex], portArrayIndex + 1, info.GetIsolate(), exceptionState); 124 *portArray = toRefPtrWillBeMemberNativeArray<MessagePort, V8MessagePort> (info[portArrayIndex], portArrayIndex + 1, info.GetIsolate(), exceptionState);
125 if (exceptionState.throwIfNeeded()) 125 if (exceptionState.throwIfNeeded())
126 return; 126 return;
127 } 127 }
128 event->initMessageEvent(typeArg, canBubbleArg, cancelableArg, originArg, las tEventIdArg, sourceArg, portArray.release()); 128 event->initMessageEvent(typeArg, canBubbleArg, cancelableArg, originArg, las tEventIdArg, sourceArg, portArray.release());
129 129
130 if (!dataArg.IsEmpty()) { 130 if (!dataArg.IsEmpty()) {
131 V8HiddenValue::setHiddenValue(info.GetIsolate(), info.Holder(), V8Hidden Value::data(info.GetIsolate()), dataArg); 131 V8HiddenValue::setHiddenValue(info.GetIsolate(), info.Holder(), V8Hidden Value::data(info.GetIsolate()), dataArg);
132 if (DOMWrapperWorld::current(info.GetIsolate()).isIsolatedWorld()) 132 if (DOMWrapperWorld::current(info.GetIsolate()).isIsolatedWorld())
133 event->setSerializedData(SerializedScriptValueFactory::instance().cr eateAndSwallowExceptions(info.GetIsolate(), dataArg)); 133 event->setSerializedData(SerializedScriptValueFactory::instance().cr eateAndSwallowExceptions(info.GetIsolate(), dataArg));
134 } 134 }
135 } 135 }
136 136
137 } // namespace blink 137 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698