OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/browser/media/webrtc_identity_store_backend.h" | 5 #include "content/browser/media/webrtc_identity_store_backend.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 // Implementation of SqlLiteStorage. | 362 // Implementation of SqlLiteStorage. |
363 // | 363 // |
364 | 364 |
365 void WebRTCIdentityStoreBackend::SqlLiteStorage::Load(IdentityMap* out_map) { | 365 void WebRTCIdentityStoreBackend::SqlLiteStorage::Load(IdentityMap* out_map) { |
366 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 366 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
367 DCHECK(!db_.get()); | 367 DCHECK(!db_.get()); |
368 | 368 |
369 // Ensure the parent directory for storing certs is created before reading | 369 // Ensure the parent directory for storing certs is created before reading |
370 // from it. | 370 // from it. |
371 const base::FilePath dir = path_.DirName(); | 371 const base::FilePath dir = path_.DirName(); |
372 if (!base::PathExists(dir) && !file_util::CreateDirectory(dir)) { | 372 if (!base::PathExists(dir) && !base::CreateDirectory(dir)) { |
373 DLOG(ERROR) << "Unable to open DB file path."; | 373 DLOG(ERROR) << "Unable to open DB file path."; |
374 return; | 374 return; |
375 } | 375 } |
376 | 376 |
377 db_.reset(new sql::Connection()); | 377 db_.reset(new sql::Connection()); |
378 | 378 |
379 db_->set_error_callback(base::Bind(&SqlLiteStorage::OnDatabaseError, this)); | 379 db_->set_error_callback(base::Bind(&SqlLiteStorage::OnDatabaseError, this)); |
380 | 380 |
381 if (!db_->Open(path_)) { | 381 if (!db_->Open(path_)) { |
382 DLOG(ERROR) << "Unable to open DB."; | 382 DLOG(ERROR) << "Unable to open DB."; |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 default: | 574 default: |
575 NOTREACHED(); | 575 NOTREACHED(); |
576 break; | 576 break; |
577 } | 577 } |
578 } | 578 } |
579 transaction.Commit(); | 579 transaction.Commit(); |
580 pending_operations_.clear(); | 580 pending_operations_.clear(); |
581 } | 581 } |
582 | 582 |
583 } // namespace content | 583 } // namespace content |
OLD | NEW |