OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/browser/notifications/notification_database.h" | 5 #include "content/browser/notifications/notification_database.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 kDataKeyPrefix, | 61 kDataKeyPrefix, |
62 storage::GetIdentifierFromOrigin(origin).c_str(), | 62 storage::GetIdentifierFromOrigin(origin).c_str(), |
63 kKeySeparator, | 63 kKeySeparator, |
64 base::Int64ToString(notification_id).c_str()); | 64 base::Int64ToString(notification_id).c_str()); |
65 } | 65 } |
66 | 66 |
67 } // namespace | 67 } // namespace |
68 | 68 |
69 NotificationDatabase::NotificationDatabase(const base::FilePath& path) | 69 NotificationDatabase::NotificationDatabase(const base::FilePath& path) |
70 : path_(path) { | 70 : path_(path) { |
71 sequence_checker_.DetachFromSequence(); | |
72 } | 71 } |
73 | 72 |
74 NotificationDatabase::~NotificationDatabase() { | 73 NotificationDatabase::~NotificationDatabase() { |
75 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); | 74 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); |
76 } | 75 } |
77 | 76 |
78 NotificationDatabase::Status NotificationDatabase::Open( | 77 NotificationDatabase::Status NotificationDatabase::Open( |
79 bool create_if_missing) { | 78 bool create_if_missing) { |
80 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); | 79 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); |
81 DCHECK_EQ(STATE_UNINITIALIZED, state_); | 80 DCHECK_EQ(STATE_UNINITIALIZED, state_); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 | 210 |
212 if (!base::StringToInt64(value, &next_notification_id_) || | 211 if (!base::StringToInt64(value, &next_notification_id_) || |
213 next_notification_id_ < kFirstNotificationId) { | 212 next_notification_id_ < kFirstNotificationId) { |
214 return STATUS_ERROR_CORRUPTED; | 213 return STATUS_ERROR_CORRUPTED; |
215 } | 214 } |
216 | 215 |
217 return STATUS_OK; | 216 return STATUS_OK; |
218 } | 217 } |
219 | 218 |
220 } // namespace content | 219 } // namespace content |
OLD | NEW |