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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 kKeySeparator, | 64 kKeySeparator, |
65 base::Int64ToString(notification_id).c_str()); | 65 base::Int64ToString(notification_id).c_str()); |
66 } | 66 } |
67 | 67 |
68 } // namespace | 68 } // namespace |
69 | 69 |
70 NotificationDatabase::NotificationDatabase(const base::FilePath& path) | 70 NotificationDatabase::NotificationDatabase(const base::FilePath& path) |
71 : path_(path), | 71 : path_(path), |
72 next_notification_id_(0), | 72 next_notification_id_(0), |
73 state_(STATE_UNINITIALIZED) { | 73 state_(STATE_UNINITIALIZED) { |
74 sequence_checker_.DetachFromSequence(); | |
75 } | 74 } |
76 | 75 |
77 NotificationDatabase::~NotificationDatabase() { | 76 NotificationDatabase::~NotificationDatabase() { |
78 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); | 77 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); |
79 } | 78 } |
80 | 79 |
81 NotificationDatabase::Status NotificationDatabase::Open( | 80 NotificationDatabase::Status NotificationDatabase::Open( |
82 bool create_if_missing) { | 81 bool create_if_missing) { |
83 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); | 82 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); |
84 DCHECK_EQ(STATE_UNINITIALIZED, state_); | 83 DCHECK_EQ(STATE_UNINITIALIZED, state_); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 if (!base::StringToInt64(value, &next_notification_id) || | 229 if (!base::StringToInt64(value, &next_notification_id) || |
231 next_notification_id < kFirstNotificationId) { | 230 next_notification_id < kFirstNotificationId) { |
232 return STATUS_ERROR_CORRUPTED; | 231 return STATUS_ERROR_CORRUPTED; |
233 } | 232 } |
234 | 233 |
235 *notification_id = next_notification_id; | 234 *notification_id = next_notification_id; |
236 return STATUS_OK; | 235 return STATUS_OK; |
237 } | 236 } |
238 | 237 |
239 } // namespace content | 238 } // namespace content |
OLD | NEW |