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

Side by Side Diff: content/common/indexed_db/indexed_db_param_traits.cc

Issue 9212038: Distinguish null IDBKey (no value) and invalid IDBKey (value is not valid key) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Re-enable IndexedDBUILayoutTest.LayoutTests Created 8 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « content/common/indexed_db/indexed_db_key.cc ('k') | webkit/glue/idb_bindings.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/indexed_db/indexed_db_param_traits.h" 5 #include "content/common/indexed_db/indexed_db_param_traits.h"
6 6
7 #include "content/common/indexed_db/indexed_db_key.h" 7 #include "content/common/indexed_db/indexed_db_key.h"
8 #include "content/public/common/serialized_script_value.h" 8 #include "content/public/common/serialized_script_value.h"
9 #include "ipc/ipc_message_utils.h" 9 #include "ipc/ipc_message_utils.h"
10 10
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 case WebKit::WebIDBKey::StringType: 55 case WebKit::WebIDBKey::StringType:
56 WriteParam(m, p.string()); 56 WriteParam(m, p.string());
57 return; 57 return;
58 case WebKit::WebIDBKey::DateType: 58 case WebKit::WebIDBKey::DateType:
59 WriteParam(m, p.date()); 59 WriteParam(m, p.date());
60 return; 60 return;
61 case WebKit::WebIDBKey::NumberType: 61 case WebKit::WebIDBKey::NumberType:
62 WriteParam(m, p.number()); 62 WriteParam(m, p.number());
63 return; 63 return;
64 case WebKit::WebIDBKey::InvalidType: 64 case WebKit::WebIDBKey::InvalidType:
65 default: 65 case WebKit::WebIDBKey::NullType:
66 // TODO(jsbell): Remove "default" label once WebKit bug 76487 has rolled.
67 // http://crbug.com/110956
68 return; 66 return;
69 } 67 }
70 NOTREACHED(); 68 NOTREACHED();
71 } 69 }
72 70
73 bool ParamTraits<IndexedDBKey>::Read(const Message* m, 71 bool ParamTraits<IndexedDBKey>::Read(const Message* m,
74 void** iter, 72 void** iter,
75 param_type* r) { 73 param_type* r) {
76 int type; 74 int type;
77 if (!ReadParam(m, iter, &type)) 75 if (!ReadParam(m, iter, &type))
(...skipping 26 matching lines...) Expand all
104 } 102 }
105 case WebKit::WebIDBKey::NumberType: 103 case WebKit::WebIDBKey::NumberType:
106 { 104 {
107 double number; 105 double number;
108 if (!ReadParam(m, iter, &number)) 106 if (!ReadParam(m, iter, &number))
109 return false; 107 return false;
110 r->SetNumber(number); 108 r->SetNumber(number);
111 return true; 109 return true;
112 } 110 }
113 case WebKit::WebIDBKey::InvalidType: 111 case WebKit::WebIDBKey::InvalidType:
114 default:
115 // TODO(jsbell): Remove "default" label once WebKit bug 76487 has rolled.
116 // http://crbug.com/110956
117 r->SetInvalid(); 112 r->SetInvalid();
118 return true; 113 return true;
114 case WebKit::WebIDBKey::NullType:
115 r->SetNull();
116 return true;
119 } 117 }
120 NOTREACHED(); 118 NOTREACHED();
121 return false; 119 return false;
122 } 120 }
123 121
124 void ParamTraits<IndexedDBKey>::Log(const param_type& p, std::string* l) { 122 void ParamTraits<IndexedDBKey>::Log(const param_type& p, std::string* l) {
125 l->append("<IndexedDBKey>("); 123 l->append("<IndexedDBKey>(");
126 LogParam(int(p.type()), l); 124 LogParam(int(p.type()), l);
127 l->append(", "); 125 l->append(", ");
128 l->append("["); 126 l->append("[");
129 std::vector<IndexedDBKey>::const_iterator it = p.array().begin(); 127 std::vector<IndexedDBKey>::const_iterator it = p.array().begin();
130 while (it != p.array().end()) { 128 while (it != p.array().end()) {
131 Log(*it, l); 129 Log(*it, l);
132 ++it; 130 ++it;
133 if (it != p.array().end()) 131 if (it != p.array().end())
134 l->append(", "); 132 l->append(", ");
135 } 133 }
136 l->append("], "); 134 l->append("], ");
137 LogParam(p.string(), l); 135 LogParam(p.string(), l);
138 l->append(", "); 136 l->append(", ");
139 LogParam(p.date(), l); 137 LogParam(p.date(), l);
140 l->append(", "); 138 l->append(", ");
141 LogParam(p.number(), l); 139 LogParam(p.number(), l);
142 l->append(")"); 140 l->append(")");
143 } 141 }
144 142
145 } // namespace IPC 143 } // namespace IPC
OLDNEW
« no previous file with comments | « content/common/indexed_db/indexed_db_key.cc ('k') | webkit/glue/idb_bindings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698