Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(370)

Side by Side Diff: components/precache/core/precache_database.h

Issue 1921923002: Convert //components/[o-t]* from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef COMPONENTS_PRECACHE_CORE_PRECACHE_DATABASE_H_ 5 #ifndef COMPONENTS_PRECACHE_CORE_PRECACHE_DATABASE_H_
6 #define COMPONENTS_PRECACHE_CORE_PRECACHE_DATABASE_H_ 6 #define COMPONENTS_PRECACHE_CORE_PRECACHE_DATABASE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory>
10 #include <string> 11 #include <string>
11 #include <vector> 12 #include <vector>
12 13
13 #include "base/callback.h" 14 #include "base/callback.h"
14 #include "base/containers/hash_tables.h" 15 #include "base/containers/hash_tables.h"
15 #include "base/macros.h" 16 #include "base/macros.h"
16 #include "base/memory/scoped_ptr.h"
17 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
18 #include "base/threading/thread_checker.h" 18 #include "base/threading/thread_checker.h"
19 #include "components/precache/core/precache_url_table.h" 19 #include "components/precache/core/precache_url_table.h"
20 20
21 class GURL; 21 class GURL;
22 22
23 namespace base { 23 namespace base {
24 class FilePath; 24 class FilePath;
25 class Time; 25 class Time;
26 } 26 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 // Same as Flush(), but also updates the flag |is_flush_posted_| to indicate 84 // Same as Flush(), but also updates the flag |is_flush_posted_| to indicate
85 // that a flush is no longer posted. 85 // that a flush is no longer posted.
86 void PostedFlush(); 86 void PostedFlush();
87 87
88 // Post a call to PostedFlush() on the current thread's MessageLoop, if 88 // Post a call to PostedFlush() on the current thread's MessageLoop, if
89 // |buffered_writes_| is non-empty and there isn't already a flush call 89 // |buffered_writes_| is non-empty and there isn't already a flush call
90 // posted. 90 // posted.
91 void MaybePostFlush(); 91 void MaybePostFlush();
92 92
93 scoped_ptr<sql::Connection> db_; 93 std::unique_ptr<sql::Connection> db_;
94 94
95 // Table that keeps track of URLs that are in the cache because of precaching, 95 // Table that keeps track of URLs that are in the cache because of precaching,
96 // and wouldn't be in the cache otherwise. If |buffered_writes_| is non-empty, 96 // and wouldn't be in the cache otherwise. If |buffered_writes_| is non-empty,
97 // then this table will not be up to date until the next call to Flush(). 97 // then this table will not be up to date until the next call to Flush().
98 PrecacheURLTable precache_url_table_; 98 PrecacheURLTable precache_url_table_;
99 99
100 // A vector of write operations to be run on the database. 100 // A vector of write operations to be run on the database.
101 std::vector<base::Closure> buffered_writes_; 101 std::vector<base::Closure> buffered_writes_;
102 102
103 // Set of URLs that have been modified in |buffered_writes_|. It's a hash set 103 // Set of URLs that have been modified in |buffered_writes_|. It's a hash set
104 // of strings, and not GURLs, because there is no hash function on GURL. 104 // of strings, and not GURLs, because there is no hash function on GURL.
105 base::hash_set<std::string> buffered_urls_; 105 base::hash_set<std::string> buffered_urls_;
106 106
107 // Flag indicating whether or not a call to Flush() has been posted to run in 107 // Flag indicating whether or not a call to Flush() has been posted to run in
108 // the future. 108 // the future.
109 bool is_flush_posted_; 109 bool is_flush_posted_;
110 110
111 // ThreadChecker used to ensure that all methods other than the constructor 111 // ThreadChecker used to ensure that all methods other than the constructor
112 // or destructor are called on the same thread. 112 // or destructor are called on the same thread.
113 base::ThreadChecker thread_checker_; 113 base::ThreadChecker thread_checker_;
114 114
115 base::WeakPtrFactory<PrecacheDatabase> weak_factory_; 115 base::WeakPtrFactory<PrecacheDatabase> weak_factory_;
116 116
117 DISALLOW_COPY_AND_ASSIGN(PrecacheDatabase); 117 DISALLOW_COPY_AND_ASSIGN(PrecacheDatabase);
118 }; 118 };
119 119
120 } // namespace precache 120 } // namespace precache
121 121
122 #endif // COMPONENTS_PRECACHE_CORE_PRECACHE_DATABASE_H_ 122 #endif // COMPONENTS_PRECACHE_CORE_PRECACHE_DATABASE_H_
OLDNEW
« no previous file with comments | « components/precache/core/fetcher_pool_unittest.cc ('k') | components/precache/core/precache_database_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698