| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "google_apis/gcm/engine/gcm_store_impl.h" | 5 #include "google_apis/gcm/engine/gcm_store_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 DVLOG(2) << "Database " << path_.value() << " does not exist"; | 298 DVLOG(2) << "Database " << path_.value() << " does not exist"; |
| 299 return STORE_DOES_NOT_EXIST; | 299 return STORE_DOES_NOT_EXIST; |
| 300 } | 300 } |
| 301 | 301 |
| 302 leveldb::Options options; | 302 leveldb::Options options; |
| 303 options.create_if_missing = open_mode == CREATE_IF_MISSING; | 303 options.create_if_missing = open_mode == CREATE_IF_MISSING; |
| 304 options.reuse_logs = leveldb_env::kDefaultLogReuseOptionValue; | 304 options.reuse_logs = leveldb_env::kDefaultLogReuseOptionValue; |
| 305 options.paranoid_checks = true; | 305 options.paranoid_checks = true; |
| 306 leveldb::DB* db; | 306 leveldb::DB* db; |
| 307 leveldb::Status status = | 307 leveldb::Status status = |
| 308 leveldb::DB::Open(options, path_.AsUTF8Unsafe(), &db); | 308 leveldb_env::DBRegistry::Open(options, path_.AsUTF8Unsafe(), &db); |
| 309 UMA_HISTOGRAM_ENUMERATION("GCM.Database.Open", | 309 UMA_HISTOGRAM_ENUMERATION("GCM.Database.Open", |
| 310 leveldb_env::GetLevelDBStatusUMAValue(status), | 310 leveldb_env::GetLevelDBStatusUMAValue(status), |
| 311 leveldb_env::LEVELDB_STATUS_MAX); | 311 leveldb_env::LEVELDB_STATUS_MAX); |
| 312 if (!status.ok()) { | 312 if (!status.ok()) { |
| 313 LOG(ERROR) << "Failed to open database " << path_.value() << ": " | 313 LOG(ERROR) << "Failed to open database " << path_.value() << ": " |
| 314 << status.ToString(); | 314 << status.ToString(); |
| 315 return OPENING_STORE_FAILED; | 315 return OPENING_STORE_FAILED; |
| 316 } | 316 } |
| 317 | 317 |
| 318 db_.reset(db); | 318 db_.reset(db); |
| (...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1481 removed_message_counts.begin(); | 1481 removed_message_counts.begin(); |
| 1482 iter != removed_message_counts.end(); ++iter) { | 1482 iter != removed_message_counts.end(); ++iter) { |
| 1483 DCHECK_NE(app_message_counts_.count(iter->first), 0U); | 1483 DCHECK_NE(app_message_counts_.count(iter->first), 0U); |
| 1484 app_message_counts_[iter->first] -= iter->second; | 1484 app_message_counts_[iter->first] -= iter->second; |
| 1485 DCHECK_GE(app_message_counts_[iter->first], 0); | 1485 DCHECK_GE(app_message_counts_[iter->first], 0); |
| 1486 } | 1486 } |
| 1487 callback.Run(true); | 1487 callback.Run(true); |
| 1488 } | 1488 } |
| 1489 | 1489 |
| 1490 } // namespace gcm | 1490 } // namespace gcm |
| OLD | NEW |