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

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

Issue 358573002: [ServiceWorker] Implement Headers class. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 6 years, 5 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
« no previous file with comments | « Source/bindings/v8/Dictionary.h ('k') | Source/modules/modules.gypi » ('j') | 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) 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 21 matching lines...) Expand all
32 #include "bindings/core/v8/V8MediaKeyError.h" 32 #include "bindings/core/v8/V8MediaKeyError.h"
33 #include "bindings/core/v8/V8MessagePort.h" 33 #include "bindings/core/v8/V8MessagePort.h"
34 #include "bindings/core/v8/V8Storage.h" 34 #include "bindings/core/v8/V8Storage.h"
35 #include "bindings/core/v8/V8TextTrack.h" 35 #include "bindings/core/v8/V8TextTrack.h"
36 #include "bindings/core/v8/V8VoidCallback.h" 36 #include "bindings/core/v8/V8VoidCallback.h"
37 #include "bindings/core/v8/V8Window.h" 37 #include "bindings/core/v8/V8Window.h"
38 #include "bindings/core/v8/custom/V8ArrayBufferViewCustom.h" 38 #include "bindings/core/v8/custom/V8ArrayBufferViewCustom.h"
39 #include "bindings/core/v8/custom/V8Uint8ArrayCustom.h" 39 #include "bindings/core/v8/custom/V8Uint8ArrayCustom.h"
40 #include "bindings/modules/v8/V8Gamepad.h" 40 #include "bindings/modules/v8/V8Gamepad.h"
41 #include "bindings/modules/v8/V8HeaderMap.h" 41 #include "bindings/modules/v8/V8HeaderMap.h"
42 #include "bindings/modules/v8/V8Headers.h"
42 #include "bindings/modules/v8/V8IDBKeyRange.h" 43 #include "bindings/modules/v8/V8IDBKeyRange.h"
43 #include "bindings/modules/v8/V8MIDIPort.h" 44 #include "bindings/modules/v8/V8MIDIPort.h"
44 #include "bindings/modules/v8/V8MediaStream.h" 45 #include "bindings/modules/v8/V8MediaStream.h"
45 #include "bindings/modules/v8/V8SpeechRecognitionResult.h" 46 #include "bindings/modules/v8/V8SpeechRecognitionResult.h"
46 #include "bindings/modules/v8/V8SpeechRecognitionResultList.h" 47 #include "bindings/modules/v8/V8SpeechRecognitionResultList.h"
47 #include "bindings/v8/ArrayValue.h" 48 #include "bindings/v8/ArrayValue.h"
48 #include "bindings/v8/ExceptionMessages.h" 49 #include "bindings/v8/ExceptionMessages.h"
49 #include "bindings/v8/ExceptionState.h" 50 #include "bindings/v8/ExceptionState.h"
50 #include "bindings/v8/V8Binding.h" 51 #include "bindings/v8/V8Binding.h"
51 #include "core/html/track/TrackBase.h" 52 #include "core/html/track/TrackBase.h"
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 bool Dictionary::get(const String& key, RefPtr<HeaderMap>& value) const 572 bool Dictionary::get(const String& key, RefPtr<HeaderMap>& value) const
572 { 573 {
573 v8::Local<v8::Value> v8Value; 574 v8::Local<v8::Value> v8Value;
574 if (!getKey(key, v8Value)) 575 if (!getKey(key, v8Value))
575 return false; 576 return false;
576 577
577 value = V8HeaderMap::toNativeWithTypeCheck(m_isolate, v8Value); 578 value = V8HeaderMap::toNativeWithTypeCheck(m_isolate, v8Value);
578 return true; 579 return true;
579 } 580 }
580 581
582 bool Dictionary::get(const String& key, RefPtr<Headers>& value) const
583 {
584 v8::Local<v8::Value> v8Value;
585 if (!getKey(key, v8Value))
586 return false;
587
588 value = V8Headers::toNativeWithTypeCheck(m_isolate, v8Value);
589 return true;
590 }
591
581 bool Dictionary::convert(ConversionContext& context, const String& key, Dictiona ry& value) const 592 bool Dictionary::convert(ConversionContext& context, const String& key, Dictiona ry& value) const
582 { 593 {
583 ConversionContextScope scope(context); 594 ConversionContextScope scope(context);
584 595
585 v8::Local<v8::Value> v8Value; 596 v8::Local<v8::Value> v8Value;
586 if (!getKey(key, v8Value)) 597 if (!getKey(key, v8Value))
587 return true; 598 return true;
588 599
589 if (v8Value->IsObject()) 600 if (v8Value->IsObject())
590 return get(key, value); 601 return get(key, value);
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 757
747 return *this; 758 return *this;
748 } 759 }
749 760
750 void Dictionary::ConversionContext::throwTypeError(const String& detail) 761 void Dictionary::ConversionContext::throwTypeError(const String& detail)
751 { 762 {
752 exceptionState().throwTypeError(detail); 763 exceptionState().throwTypeError(detail);
753 } 764 }
754 765
755 } // namespace WebCore 766 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/Dictionary.h ('k') | Source/modules/modules.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698