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

Side by Side Diff: content/child/indexed_db/indexed_db_key_builders.cc

Issue 202863004: Fix "unreachable code" warnings (MSVC warning 4702) in content/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 9 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/child/indexed_db/indexed_db_key_builders.h" 5 #include "content/child/indexed_db/indexed_db_key_builders.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "third_party/WebKit/public/platform/WebVector.h" 8 #include "third_party/WebKit/public/platform/WebVector.h"
9 9
10 using blink::WebIDBKey; 10 using blink::WebIDBKey;
(...skipping 27 matching lines...) Expand all
38 return copy; 38 return copy;
39 } 39 }
40 40
41 41
42 namespace content { 42 namespace content {
43 43
44 IndexedDBKey IndexedDBKeyBuilder::Build(const blink::WebIDBKey& key) { 44 IndexedDBKey IndexedDBKeyBuilder::Build(const blink::WebIDBKey& key) {
45 switch (key.keyType()) { 45 switch (key.keyType()) {
46 case WebIDBKeyTypeArray: 46 case WebIDBKeyTypeArray:
47 return IndexedDBKey(CopyKeyArray(key)); 47 return IndexedDBKey(CopyKeyArray(key));
48
jam 2014/03/19 16:44:36 ditto
Peter Kasting 2014/03/19 21:10:57 Done.
48 case WebIDBKeyTypeBinary: 49 case WebIDBKeyTypeBinary:
49 return IndexedDBKey( 50 return IndexedDBKey(
50 std::string(key.binary().data(), key.binary().size())); 51 std::string(key.binary().data(), key.binary().size()));
52
51 case WebIDBKeyTypeString: 53 case WebIDBKeyTypeString:
52 return IndexedDBKey(key.string()); 54 return IndexedDBKey(key.string());
55
53 case WebIDBKeyTypeDate: 56 case WebIDBKeyTypeDate:
54 return IndexedDBKey(key.date(), WebIDBKeyTypeDate); 57 return IndexedDBKey(key.date(), WebIDBKeyTypeDate);
58
55 case WebIDBKeyTypeNumber: 59 case WebIDBKeyTypeNumber:
56 return IndexedDBKey(key.number(), WebIDBKeyTypeNumber); 60 return IndexedDBKey(key.number(), WebIDBKeyTypeNumber);
61
57 case WebIDBKeyTypeNull: 62 case WebIDBKeyTypeNull:
58 case WebIDBKeyTypeInvalid: 63 case WebIDBKeyTypeInvalid:
59 return IndexedDBKey(key.keyType()); 64 return IndexedDBKey(key.keyType());
65
60 case WebIDBKeyTypeMin: 66 case WebIDBKeyTypeMin:
61 default: 67 default:
62 NOTREACHED(); 68 NOTREACHED();
63 return IndexedDBKey(); 69 return IndexedDBKey();
64 } 70 }
65 NOTREACHED();
66 return IndexedDBKey();
67 } 71 }
68 72
69 WebIDBKey WebIDBKeyBuilder::Build(const IndexedDBKey& key) { 73 WebIDBKey WebIDBKeyBuilder::Build(const IndexedDBKey& key) {
70 switch (key.type()) { 74 switch (key.type()) {
71 case WebIDBKeyTypeArray: { 75 case WebIDBKeyTypeArray: {
72 const IndexedDBKey::KeyArray& array = key.array(); 76 const IndexedDBKey::KeyArray& array = key.array();
73 blink::WebVector<WebIDBKey> web_array(array.size()); 77 blink::WebVector<WebIDBKey> web_array(array.size());
74 for (size_t i = 0; i < array.size(); ++i) { 78 for (size_t i = 0; i < array.size(); ++i) {
75 web_array[i] = Build(array[i]); 79 web_array[i] = Build(array[i]);
76 } 80 }
77 return WebIDBKey::createArray(web_array); 81 return WebIDBKey::createArray(web_array);
78 } 82 }
83
79 case WebIDBKeyTypeBinary: 84 case WebIDBKeyTypeBinary:
80 return WebIDBKey::createBinary(key.binary()); 85 return WebIDBKey::createBinary(key.binary());
86
81 case WebIDBKeyTypeString: 87 case WebIDBKeyTypeString:
82 return WebIDBKey::createString(key.string()); 88 return WebIDBKey::createString(key.string());
89
83 case WebIDBKeyTypeDate: 90 case WebIDBKeyTypeDate:
84 return WebIDBKey::createDate(key.date()); 91 return WebIDBKey::createDate(key.date());
92
85 case WebIDBKeyTypeNumber: 93 case WebIDBKeyTypeNumber:
86 return WebIDBKey::createNumber(key.number()); 94 return WebIDBKey::createNumber(key.number());
95
87 case WebIDBKeyTypeInvalid: 96 case WebIDBKeyTypeInvalid:
88 return WebIDBKey::createInvalid(); 97 return WebIDBKey::createInvalid();
98
89 case WebIDBKeyTypeNull: 99 case WebIDBKeyTypeNull:
90 return WebIDBKey::createNull(); 100 return WebIDBKey::createNull();
101
91 case WebIDBKeyTypeMin: 102 case WebIDBKeyTypeMin:
92 default: 103 default:
93 NOTREACHED(); 104 NOTREACHED();
94 return WebIDBKey::createInvalid(); 105 return WebIDBKey::createInvalid();
95 } 106 }
96 NOTREACHED();
97 return WebIDBKey::createInvalid();
98 } 107 }
99 108
100 IndexedDBKeyRange IndexedDBKeyRangeBuilder::Build( 109 IndexedDBKeyRange IndexedDBKeyRangeBuilder::Build(
101 const WebIDBKeyRange& key_range) { 110 const WebIDBKeyRange& key_range) {
102 return IndexedDBKeyRange( 111 return IndexedDBKeyRange(
103 IndexedDBKeyBuilder::Build(key_range.lower()), 112 IndexedDBKeyBuilder::Build(key_range.lower()),
104 IndexedDBKeyBuilder::Build(key_range.upper()), 113 IndexedDBKeyBuilder::Build(key_range.upper()),
105 key_range.lowerOpen(), 114 key_range.lowerOpen(),
106 key_range.upperOpen()); 115 key_range.upperOpen());
107 } 116 }
108 117
109 IndexedDBKeyPath IndexedDBKeyPathBuilder::Build( 118 IndexedDBKeyPath IndexedDBKeyPathBuilder::Build(
110 const blink::WebIDBKeyPath& key_path) { 119 const blink::WebIDBKeyPath& key_path) {
111 switch (key_path.keyPathType()) { 120 switch (key_path.keyPathType()) {
112 case blink::WebIDBKeyPathTypeString: 121 case blink::WebIDBKeyPathTypeString:
113 return IndexedDBKeyPath(key_path.string()); 122 return IndexedDBKeyPath(key_path.string());
123
114 case blink::WebIDBKeyPathTypeArray: 124 case blink::WebIDBKeyPathTypeArray:
115 return IndexedDBKeyPath(CopyArray(key_path.array())); 125 return IndexedDBKeyPath(CopyArray(key_path.array()));
126
116 case blink::WebIDBKeyPathTypeNull: 127 case blink::WebIDBKeyPathTypeNull:
117 return IndexedDBKeyPath(); 128 return IndexedDBKeyPath();
129
130 default:
131 NOTREACHED();
132 return IndexedDBKeyPath();
118 } 133 }
119 NOTREACHED();
120 return IndexedDBKeyPath();
121 } 134 }
122 135
123 blink::WebIDBKeyPath WebIDBKeyPathBuilder::Build( 136 blink::WebIDBKeyPath WebIDBKeyPathBuilder::Build(
124 const IndexedDBKeyPath& key_path) { 137 const IndexedDBKeyPath& key_path) {
125 switch (key_path.type()) { 138 switch (key_path.type()) {
126 case blink::WebIDBKeyPathTypeString: 139 case blink::WebIDBKeyPathTypeString:
127 return blink::WebIDBKeyPath::create(WebString(key_path.string())); 140 return blink::WebIDBKeyPath::create(WebString(key_path.string()));
141
128 case blink::WebIDBKeyPathTypeArray: 142 case blink::WebIDBKeyPathTypeArray:
129 return blink::WebIDBKeyPath::create(CopyArray(key_path.array())); 143 return blink::WebIDBKeyPath::create(CopyArray(key_path.array()));
144
130 case blink::WebIDBKeyPathTypeNull: 145 case blink::WebIDBKeyPathTypeNull:
131 return blink::WebIDBKeyPath::createNull(); 146 return blink::WebIDBKeyPath::createNull();
147
148 default:
149 NOTREACHED();
150 return blink::WebIDBKeyPath::createNull();
132 } 151 }
133 NOTREACHED();
134 return blink::WebIDBKeyPath::createNull();
135 } 152 }
136 153
137 } // namespace content 154 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698