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

Side by Side Diff: Source/bindings/core/v8/DictionaryHelperForCore.cpp

Issue 683013002: Extract a DOMWindow interface from LocalDOMWindow and use it in the idl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on top of DOMWindow moves and UseCounter overload for Frame Created 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 245
246 TONATIVE_DEFAULT(v8::Local<v8::Number>, v8Number, v8Value->ToNumber(), false ); 246 TONATIVE_DEFAULT(v8::Local<v8::Number>, v8Number, v8Value->ToNumber(), false );
247 if (v8Number.IsEmpty()) 247 if (v8Number.IsEmpty())
248 return false; 248 return false;
249 double d = v8Number->Value(); 249 double d = v8Number->Value();
250 doubleToInteger(d, value); 250 doubleToInteger(d, value);
251 return true; 251 return true;
252 } 252 }
253 253
254 template <> 254 template <>
255 bool DictionaryHelper::get(const Dictionary& dictionary, const String& key, RefP trWillBeMember<LocalDOMWindow>& value) 255 bool DictionaryHelper::get(const Dictionary& dictionary, const String& key, RefP trWillBeMember<DOMWindow>& value)
256 { 256 {
257 v8::Local<v8::Value> v8Value; 257 v8::Local<v8::Value> v8Value;
258 if (!dictionary.get(key, v8Value)) 258 if (!dictionary.get(key, v8Value))
259 return false; 259 return false;
260 260
261 // We need to handle a DOMWindow specially, because a DOMWindow wrapper 261 // We need to handle a DOMWindow specially, because a DOMWindow wrapper
262 // exists on a prototype chain of v8Value. 262 // exists on a prototype chain of v8Value.
263 value = toDOMWindow(v8Value, dictionary.isolate()); 263 value = toDOMWindow(v8Value, dictionary.isolate());
264 return true; 264 return true;
265 } 265 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 } 329 }
330 330
331 template <> 331 template <>
332 bool DictionaryHelper::get(const Dictionary& dictionary, const String& key, RefP trWillBeMember<EventTarget>& value) 332 bool DictionaryHelper::get(const Dictionary& dictionary, const String& key, RefP trWillBeMember<EventTarget>& value)
333 { 333 {
334 v8::Local<v8::Value> v8Value; 334 v8::Local<v8::Value> v8Value;
335 if (!dictionary.get(key, v8Value)) 335 if (!dictionary.get(key, v8Value))
336 return false; 336 return false;
337 337
338 value = nullptr; 338 value = nullptr;
339 // We need to handle a LocalDOMWindow specially, because a LocalDOMWindow wr apper 339 // We need to handle a DOMWindow specially, because a DOMWindow wrapper
340 // exists on a prototype chain of v8Value. 340 // exists on a prototype chain of v8Value.
341 if (v8Value->IsObject()) { 341 if (v8Value->IsObject()) {
342 v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(v8Value); 342 v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(v8Value);
343 v8::Handle<v8::Object> window = V8Window::findInstanceInPrototypeChain(w rapper, dictionary.isolate()); 343 v8::Handle<v8::Object> window = V8Window::findInstanceInPrototypeChain(w rapper, dictionary.isolate());
344 if (!window.IsEmpty()) { 344 if (!window.IsEmpty()) {
345 value = toWrapperTypeInfo(window)->toEventTarget(window); 345 value = toWrapperTypeInfo(window)->toEventTarget(window);
346 return true; 346 return true;
347 } 347 }
348 } 348 }
349 349
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, Nullable<int8_t>& value); 645 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, Nullable<int8_t>& value);
646 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, Nullable<unsigned short>& value); 646 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, Nullable<unsigned short>& value);
647 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, Nullable<short>& value); 647 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, Nullable<short>& value);
648 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, Nullable<unsigned>& value); 648 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, Nullable<unsigned>& value);
649 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, Nullable<unsigned long>& value); 649 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, Nullable<unsigned long>& value);
650 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, Nullable<int>& value); 650 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, Nullable<int>& value);
651 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, Nullable<long>& value); 651 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, Nullable<long>& value);
652 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, Nullable<long long>& value); 652 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, Nullable<long long>& value);
653 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, Nullable<unsigned long long>& value); 653 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, Nullable<unsigned long long>& value);
654 654
655 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, RefPtrWillBeMember<LocalDOMWindow>& value); 655 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, RefPtrWillBeMember<DOMWindow>& value);
656 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, RefPtrWillBeMember<Storage>& value); 656 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, RefPtrWillBeMember<Storage>& value);
657 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, RefPtr<DOMUint8Array>& value); 657 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, RefPtr<DOMUint8Array>& value);
658 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, RefPtr<DOMArrayBufferView>& value); 658 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, RefPtr<DOMArrayBufferView>& value);
659 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, RefPtrWillBeMember<MediaKeyError>& value); 659 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, RefPtrWillBeMember<MediaKeyError>& value);
660 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, RefPtrWillBeMember<TrackBase>& value); 660 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, RefPtrWillBeMember<TrackBase>& value);
661 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, RefPtrWillBeMember<EventTarget>& value); 661 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, RefPtrWillBeMember<EventTarget>& value);
662 662
663 template <> 663 template <>
664 bool DictionaryHelper::convert(const Dictionary& dictionary, Dictionary::Convers ionContext& context, const String& key, MessagePortArray& value) 664 bool DictionaryHelper::convert(const Dictionary& dictionary, Dictionary::Convers ionContext& context, const String& key, MessagePortArray& value)
665 { 665 {
(...skipping 11 matching lines...) Expand all
677 677
678 value = toRefPtrWillBeMemberNativeArray<MessagePort, V8MessagePort>(v8Value, key, dictionary.isolate(), context.exceptionState()); 678 value = toRefPtrWillBeMemberNativeArray<MessagePort, V8MessagePort>(v8Value, key, dictionary.isolate(), context.exceptionState());
679 679
680 if (context.exceptionState().throwIfNeeded()) 680 if (context.exceptionState().throwIfNeeded())
681 return false; 681 return false;
682 682
683 return true; 683 return true;
684 } 684 }
685 685
686 } // namespace blink 686 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698