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

Side by Side Diff: chrome/browser/visitedlink/visitedlink_master.h

Issue 9122022: Revert 116816 - Hook up the SequencedWorkerPool to the browser thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/crash_upload_list.cc ('k') | chrome/browser/visitedlink/visitedlink_master.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 CHROME_BROWSER_VISITEDLINK_VISITEDLINK_MASTER_H_ 5 #ifndef CHROME_BROWSER_VISITEDLINK_VISITEDLINK_MASTER_H_
6 #define CHROME_BROWSER_VISITEDLINK_VISITEDLINK_MASTER_H_ 6 #define CHROME_BROWSER_VISITEDLINK_VISITEDLINK_MASTER_H_
7 #pragma once 7 #pragma once
8 8
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <windows.h> 10 #include <windows.h>
11 #endif 11 #endif
12 #include <set> 12 #include <set>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/callback_forward.h" 15 #include "base/callback_forward.h"
16 #include "base/file_path.h" 16 #include "base/file_path.h"
17 #include "base/gtest_prod_util.h" 17 #include "base/gtest_prod_util.h"
18 #include "base/memory/ref_counted.h" 18 #include "base/memory/ref_counted.h"
19 #include "base/shared_memory.h" 19 #include "base/shared_memory.h"
20 #include "base/threading/sequenced_worker_pool.h"
21 #include "chrome/browser/history/history.h" 20 #include "chrome/browser/history/history.h"
22 #include "chrome/common/visitedlink_common.h" 21 #include "chrome/common/visitedlink_common.h"
23 22
24 class GURL; 23 class GURL;
25 class Profile; 24 class Profile;
26 25
27 // Controls the link coloring database. The master controls all writing to the 26 // Controls the link coloring database. The master controls all writing to the
28 // database as well as disk I/O. There should be only one master. 27 // database as well as disk I/O. There should be only one master.
29 // 28 //
30 // This class will defer writing operations to the file thread. This means that 29 // This class will defer writing operations to the file thread. This means that
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 void InitMembers(Listener* listener, Profile* profile); 156 void InitMembers(Listener* listener, Profile* profile);
158 157
159 // If a rebuild is in progress, we save the URL in the temporary list. 158 // If a rebuild is in progress, we save the URL in the temporary list.
160 // Otherwise, we add this to the table. Returns the index of the 159 // Otherwise, we add this to the table. Returns the index of the
161 // inserted fingerprint or null_hash_ on failure. 160 // inserted fingerprint or null_hash_ on failure.
162 Hash TryToAddURL(const GURL& url); 161 Hash TryToAddURL(const GURL& url);
163 162
164 // File I/O functions 163 // File I/O functions
165 // ------------------ 164 // ------------------
166 165
167 // Posts the given task to the blocking worker pool with our options.
168 void PostIOTask(const tracked_objects::Location& from_here,
169 const base::Closure& task);
170
171 // Writes the entire table to disk, returning true on success. It will leave 166 // Writes the entire table to disk, returning true on success. It will leave
172 // the table file open and the handle to it in file_ 167 // the table file open and the handle to it in file_
173 bool WriteFullTable(); 168 bool WriteFullTable();
174 169
175 // Try to load the table from the database file. If the file doesn't exist or 170 // Try to load the table from the database file. If the file doesn't exist or
176 // is corrupt, this will return failure. 171 // is corrupt, this will return failure.
177 bool InitFromFile(); 172 bool InitFromFile();
178 173
179 // Reads the header of the link coloring database from disk. Assumes the 174 // Reads the header of the link coloring database from disk. Assumes the
180 // file pointer is at the beginning of the file and that there are no pending 175 // file pointer is at the beginning of the file and that there are no pending
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 // are pending, yet we don't track whether they have been completed. This 305 // are pending, yet we don't track whether they have been completed. This
311 // flag is a sanity check that these reads only happen before any 306 // flag is a sanity check that these reads only happen before any
312 // asynchronous writes have been fired. 307 // asynchronous writes have been fired.
313 bool posted_asynchronous_operation_; 308 bool posted_asynchronous_operation_;
314 #endif 309 #endif
315 310
316 // Reference to the user profile that this object belongs to 311 // Reference to the user profile that this object belongs to
317 // (it knows the path to where the data is stored) 312 // (it knows the path to where the data is stored)
318 Profile* profile_; 313 Profile* profile_;
319 314
320 // Lazily initialized sequence token for posting file tasks.
321 base::SequencedWorkerPool::SequenceToken sequence_token_;
322
323 // When non-NULL, indicates we are in database rebuild mode and points to 315 // When non-NULL, indicates we are in database rebuild mode and points to
324 // the class collecting fingerprint information from the history system. 316 // the class collecting fingerprint information from the history system.
325 // The pointer is owned by this class, but it must remain valid while the 317 // The pointer is owned by this class, but it must remain valid while the
326 // history query is running. We must only delete it when the query is done. 318 // history query is running. We must only delete it when the query is done.
327 scoped_refptr<TableBuilder> table_builder_; 319 scoped_refptr<TableBuilder> table_builder_;
328 320
329 // Indicates URLs added and deleted since we started rebuilding the table. 321 // Indicates URLs added and deleted since we started rebuilding the table.
330 std::set<Fingerprint> added_since_rebuild_; 322 std::set<Fingerprint> added_since_rebuild_;
331 std::set<Fingerprint> deleted_since_rebuild_; 323 std::set<Fingerprint> deleted_since_rebuild_;
332 324
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 int32 used_count = 0; 380 int32 used_count = 0;
389 for (int32 i = 0; i < table_length_; i++) { 381 for (int32 i = 0; i < table_length_; i++) {
390 if (hash_table_[i]) 382 if (hash_table_[i])
391 used_count++; 383 used_count++;
392 } 384 }
393 DCHECK_EQ(used_count, used_items_); 385 DCHECK_EQ(used_count, used_items_);
394 } 386 }
395 #endif 387 #endif
396 388
397 #endif // CHROME_BROWSER_VISITEDLINK_VISITEDLINK_MASTER_H_ 389 #endif // CHROME_BROWSER_VISITEDLINK_VISITEDLINK_MASTER_H_
OLDNEW
« no previous file with comments | « chrome/browser/crash_upload_list.cc ('k') | chrome/browser/visitedlink/visitedlink_master.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698