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

Side by Side Diff: Source/bindings/core/v8/Dictionary.h

Issue 724183004: Simplify Dictionary::ConversionContext (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
« no previous file with comments | « no previous file | Source/bindings/templates/interface.h » ('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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 // Sets properties using default attributes. 69 // Sets properties using default attributes.
70 bool set(const String&, const v8::Handle<v8::Value>&); 70 bool set(const String&, const v8::Handle<v8::Value>&);
71 bool set(const String&, const String&); 71 bool set(const String&, const String&);
72 bool set(const String&, unsigned); 72 bool set(const String&, unsigned);
73 bool set(const String&, const Dictionary&); 73 bool set(const String&, const Dictionary&);
74 74
75 v8::Handle<v8::Value> v8Value() const { return m_options; } 75 v8::Handle<v8::Value> v8Value() const { return m_options; }
76 76
77 class ConversionContext { 77 class ConversionContext {
78 public: 78 public:
79 ConversionContext(const String& interfaceName, const String& methodName, ExceptionState& exceptionState) 79 ConversionContext(ExceptionState& exceptionState)
haraken 2014/11/14 08:22:24 Add explicit.
bashi 2014/11/14 08:27:18 Done.
80 : m_interfaceName(interfaceName) 80 : m_exceptionState(exceptionState)
81 , m_methodName(methodName)
82 , m_exceptionState(exceptionState)
83 , m_dirty(true) 81 , m_dirty(true)
84 { 82 {
85 resetPerPropertyContext(); 83 resetPerPropertyContext();
86 } 84 }
87 85
88 const String& interfaceName() const { return m_interfaceName; }
89 const String& methodName() const { return m_methodName; }
90 bool forConstructor() const { return m_methodName.isEmpty(); }
91 ExceptionState& exceptionState() const { return m_exceptionState; } 86 ExceptionState& exceptionState() const { return m_exceptionState; }
92 87
93 bool isNullable() const { return m_isNullable; } 88 bool isNullable() const { return m_isNullable; }
94 String typeName() const { return m_propertyTypeName; } 89 String typeName() const { return m_propertyTypeName; }
95 90
96 ConversionContext& setConversionType(const String&, bool); 91 ConversionContext& setConversionType(const String&, bool);
97 92
98 void throwTypeError(const String& detail); 93 void throwTypeError(const String& detail);
99 94
100 void resetPerPropertyContext(); 95 void resetPerPropertyContext();
101 96
102 private: 97 private:
103 const String m_interfaceName;
104 const String m_methodName;
105 ExceptionState& m_exceptionState; 98 ExceptionState& m_exceptionState;
106 bool m_dirty; 99 bool m_dirty;
107 100
108 bool m_isNullable; 101 bool m_isNullable;
109 String m_propertyTypeName; 102 String m_propertyTypeName;
110 }; 103 };
111 104
112 class ConversionContextScope { 105 class ConversionContextScope {
113 public: 106 public:
114 ConversionContextScope(ConversionContext& context) 107 ConversionContextScope(ConversionContext& context)
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 static bool convert(const Dictionary&, Dictionary::ConversionContext&, const String& key, T& value); 161 static bool convert(const Dictionary&, Dictionary::ConversionContext&, const String& key, T& value);
169 template <typename T> 162 template <typename T>
170 static bool convert(const Dictionary&, Dictionary::ConversionContext&, const String& key, Nullable<T>& value); 163 static bool convert(const Dictionary&, Dictionary::ConversionContext&, const String& key, Nullable<T>& value);
171 template <template <typename> class PointerType, typename T> 164 template <template <typename> class PointerType, typename T>
172 static bool convert(const Dictionary&, Dictionary::ConversionContext&, const String& key, PointerType<T>& value); 165 static bool convert(const Dictionary&, Dictionary::ConversionContext&, const String& key, PointerType<T>& value);
173 }; 166 };
174 167
175 } 168 }
176 169
177 #endif // Dictionary_h 170 #endif // Dictionary_h
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/templates/interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698