OLD | NEW |
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 24 matching lines...) Expand all Loading... |
35 | 35 |
36 IDBAny* IDBAny::CreateUndefined() { | 36 IDBAny* IDBAny::CreateUndefined() { |
37 return new IDBAny(kUndefinedType); | 37 return new IDBAny(kUndefinedType); |
38 } | 38 } |
39 | 39 |
40 IDBAny* IDBAny::CreateNull() { | 40 IDBAny* IDBAny::CreateNull() { |
41 return new IDBAny(kNullType); | 41 return new IDBAny(kNullType); |
42 } | 42 } |
43 | 43 |
44 IDBAny::IDBAny(Type type) : type_(type) { | 44 IDBAny::IDBAny(Type type) : type_(type) { |
45 ASSERT(type == kUndefinedType || type == kNullType); | 45 DCHECK(type == kUndefinedType || type == kNullType); |
46 } | 46 } |
47 | 47 |
48 IDBAny::~IDBAny() {} | 48 IDBAny::~IDBAny() {} |
49 | 49 |
50 void IDBAny::ContextWillBeDestroyed() { | 50 void IDBAny::ContextWillBeDestroyed() { |
51 if (idb_cursor_) | 51 if (idb_cursor_) |
52 idb_cursor_->ContextWillBeDestroyed(); | 52 idb_cursor_->ContextWillBeDestroyed(); |
53 } | 53 } |
54 | 54 |
55 DOMStringList* IDBAny::DomStringList() const { | 55 DOMStringList* IDBAny::DomStringList() const { |
56 ASSERT(type_ == kDOMStringListType); | 56 DCHECK_EQ(type_, kDOMStringListType); |
57 return dom_string_list_.Get(); | 57 return dom_string_list_.Get(); |
58 } | 58 } |
59 | 59 |
60 IDBCursor* IDBAny::IdbCursor() const { | 60 IDBCursor* IDBAny::IdbCursor() const { |
61 ASSERT(type_ == kIDBCursorType); | 61 DCHECK_EQ(type_, kIDBCursorType); |
62 SECURITY_DCHECK(idb_cursor_->IsKeyCursor()); | 62 SECURITY_DCHECK(idb_cursor_->IsKeyCursor()); |
63 return idb_cursor_.Get(); | 63 return idb_cursor_.Get(); |
64 } | 64 } |
65 | 65 |
66 IDBCursorWithValue* IDBAny::IdbCursorWithValue() const { | 66 IDBCursorWithValue* IDBAny::IdbCursorWithValue() const { |
67 ASSERT(type_ == kIDBCursorWithValueType); | 67 DCHECK_EQ(type_, kIDBCursorWithValueType); |
68 SECURITY_DCHECK(idb_cursor_->IsCursorWithValue()); | 68 SECURITY_DCHECK(idb_cursor_->IsCursorWithValue()); |
69 return ToIDBCursorWithValue(idb_cursor_.Get()); | 69 return ToIDBCursorWithValue(idb_cursor_.Get()); |
70 } | 70 } |
71 | 71 |
72 IDBDatabase* IDBAny::IdbDatabase() const { | 72 IDBDatabase* IDBAny::IdbDatabase() const { |
73 ASSERT(type_ == kIDBDatabaseType); | 73 DCHECK_EQ(type_, kIDBDatabaseType); |
74 return idb_database_.Get(); | 74 return idb_database_.Get(); |
75 } | 75 } |
76 | 76 |
77 IDBIndex* IDBAny::IdbIndex() const { | 77 IDBIndex* IDBAny::IdbIndex() const { |
78 ASSERT(type_ == kIDBIndexType); | 78 DCHECK_EQ(type_, kIDBIndexType); |
79 return idb_index_.Get(); | 79 return idb_index_.Get(); |
80 } | 80 } |
81 | 81 |
82 IDBObjectStore* IDBAny::IdbObjectStore() const { | 82 IDBObjectStore* IDBAny::IdbObjectStore() const { |
83 ASSERT(type_ == kIDBObjectStoreType); | 83 DCHECK_EQ(type_, kIDBObjectStoreType); |
84 return idb_object_store_.Get(); | 84 return idb_object_store_.Get(); |
85 } | 85 } |
86 | 86 |
87 const IDBKey* IDBAny::Key() const { | 87 const IDBKey* IDBAny::Key() const { |
88 // If type is IDBValueType then instead use value()->primaryKey(). | 88 // If type is IDBValueType then instead use value()->primaryKey(). |
89 ASSERT(type_ == kKeyType); | 89 DCHECK_EQ(type_, kKeyType); |
90 return idb_key_.Get(); | 90 return idb_key_.Get(); |
91 } | 91 } |
92 | 92 |
93 IDBValue* IDBAny::Value() const { | 93 IDBValue* IDBAny::Value() const { |
94 ASSERT(type_ == kIDBValueType); | 94 DCHECK_EQ(type_, kIDBValueType); |
95 return idb_value_.Get(); | 95 return idb_value_.Get(); |
96 } | 96 } |
97 | 97 |
98 const Vector<RefPtr<IDBValue>>* IDBAny::Values() const { | 98 const Vector<RefPtr<IDBValue>>* IDBAny::Values() const { |
99 ASSERT(type_ == kIDBValueArrayType); | 99 DCHECK_EQ(type_, kIDBValueArrayType); |
100 return &idb_values_; | 100 return &idb_values_; |
101 } | 101 } |
102 | 102 |
103 int64_t IDBAny::Integer() const { | 103 int64_t IDBAny::Integer() const { |
104 ASSERT(type_ == kIntegerType); | 104 DCHECK_EQ(type_, kIntegerType); |
105 return integer_; | 105 return integer_; |
106 } | 106 } |
107 | 107 |
108 IDBAny::IDBAny(DOMStringList* value) | 108 IDBAny::IDBAny(DOMStringList* value) |
109 : type_(kDOMStringListType), dom_string_list_(value) {} | 109 : type_(kDOMStringListType), dom_string_list_(value) {} |
110 | 110 |
111 IDBAny::IDBAny(IDBCursor* value) | 111 IDBAny::IDBAny(IDBCursor* value) |
112 : type_(value->IsCursorWithValue() ? kIDBCursorWithValueType | 112 : type_(value->IsCursorWithValue() ? kIDBCursorWithValueType |
113 : kIDBCursorType), | 113 : kIDBCursorType), |
114 idb_cursor_(value) {} | 114 idb_cursor_(value) {} |
(...skipping 19 matching lines...) Expand all Loading... |
134 DEFINE_TRACE(IDBAny) { | 134 DEFINE_TRACE(IDBAny) { |
135 visitor->Trace(dom_string_list_); | 135 visitor->Trace(dom_string_list_); |
136 visitor->Trace(idb_cursor_); | 136 visitor->Trace(idb_cursor_); |
137 visitor->Trace(idb_database_); | 137 visitor->Trace(idb_database_); |
138 visitor->Trace(idb_index_); | 138 visitor->Trace(idb_index_); |
139 visitor->Trace(idb_object_store_); | 139 visitor->Trace(idb_object_store_); |
140 visitor->Trace(idb_key_); | 140 visitor->Trace(idb_key_); |
141 } | 141 } |
142 | 142 |
143 } // namespace blink | 143 } // namespace blink |
OLD | NEW |