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

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

Issue 1917673002: Convert //components/[u-z]* 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_VISITEDLINK_BROWSER_VISITEDLINK_MASTER_H_ 5 #ifndef COMPONENTS_VISITEDLINK_BROWSER_VISITEDLINK_MASTER_H_
6 #define COMPONENTS_VISITEDLINK_BROWSER_VISITEDLINK_MASTER_H_ 6 #define COMPONENTS_VISITEDLINK_BROWSER_VISITEDLINK_MASTER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <memory>
11 #include <set> 12 #include <set>
12 #include <vector> 13 #include <vector>
13 14
14 #include "base/callback.h" 15 #include "base/callback.h"
15 #include "base/callback_forward.h" 16 #include "base/callback_forward.h"
16 #include "base/files/file_path.h" 17 #include "base/files/file_path.h"
17 #include "base/gtest_prod_util.h" 18 #include "base/gtest_prod_util.h"
18 #include "base/macros.h" 19 #include "base/macros.h"
19 #include "base/memory/ref_counted.h" 20 #include "base/memory/ref_counted.h"
20 #include "base/memory/scoped_ptr.h"
21 #include "base/memory/shared_memory.h" 21 #include "base/memory/shared_memory.h"
22 #include "base/memory/weak_ptr.h" 22 #include "base/memory/weak_ptr.h"
23 #include "base/threading/sequenced_worker_pool.h" 23 #include "base/threading/sequenced_worker_pool.h"
24 #include "build/build_config.h" 24 #include "build/build_config.h"
25 #include "components/visitedlink/common/visitedlink_common.h" 25 #include "components/visitedlink/common/visitedlink_common.h"
26 26
27 #if defined(OS_WIN) 27 #if defined(OS_WIN)
28 #include <windows.h> 28 #include <windows.h>
29 #endif 29 #endif
30 30
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 bool InitFromScratch(bool suppress_rebuild); 313 bool InitFromScratch(bool suppress_rebuild);
314 314
315 // Allocates the Fingerprint structure and length. Structure is filled with 0s 315 // Allocates the Fingerprint structure and length. Structure is filled with 0s
316 // and shared header with salt and used_items_ is set to 0. 316 // and shared header with salt and used_items_ is set to 0.
317 bool CreateURLTable(int32_t num_entries); 317 bool CreateURLTable(int32_t num_entries);
318 318
319 // Allocates the Fingerprint structure and length. Returns true on success. 319 // Allocates the Fingerprint structure and length. Returns true on success.
320 // Structure is filled with 0s and shared header with salt. The result of 320 // Structure is filled with 0s and shared header with salt. The result of
321 // allocation is saved into |shared_memory| and |hash_table| points to the 321 // allocation is saved into |shared_memory| and |hash_table| points to the
322 // beginning of Fingerprint table in |shared_memory|. 322 // beginning of Fingerprint table in |shared_memory|.
323 static bool CreateApartURLTable(int32_t num_entries, 323 static bool CreateApartURLTable(
324 const uint8_t salt[LINK_SALT_LENGTH], 324 int32_t num_entries,
325 scoped_ptr<base::SharedMemory>* shared_memory, 325 const uint8_t salt[LINK_SALT_LENGTH],
326 VisitedLinkCommon::Fingerprint** hash_table); 326 std::unique_ptr<base::SharedMemory>* shared_memory,
327 VisitedLinkCommon::Fingerprint** hash_table);
327 328
328 // A wrapper for CreateURLTable, this will allocate a new table, initialized 329 // A wrapper for CreateURLTable, this will allocate a new table, initialized
329 // to empty. The caller is responsible for saving the shared memory pointer 330 // to empty. The caller is responsible for saving the shared memory pointer
330 // and handles before this call (they will be replaced with new ones) and 331 // and handles before this call (they will be replaced with new ones) and
331 // releasing them later. This is designed for callers that make a new table 332 // releasing them later. This is designed for callers that make a new table
332 // and then copy values from the old table to the new one, then release the 333 // and then copy values from the old table to the new one, then release the
333 // old table. 334 // old table.
334 // 335 //
335 // Returns true on success. On failure, the old table will be restored. The 336 // Returns true on success. On failure, the old table will be restored. The
336 // caller should not attemp to release the pointer/handle in this case. 337 // caller should not attemp to release the pointer/handle in this case.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 392
392 // Reference to the browser context that this object belongs to 393 // Reference to the browser context that this object belongs to
393 // (it knows the path to where the data is stored) 394 // (it knows the path to where the data is stored)
394 content::BrowserContext* browser_context_; 395 content::BrowserContext* browser_context_;
395 396
396 // Client owns the delegate and is responsible for it being valid through 397 // Client owns the delegate and is responsible for it being valid through
397 // the life time this VisitedLinkMaster. 398 // the life time this VisitedLinkMaster.
398 VisitedLinkDelegate* delegate_; 399 VisitedLinkDelegate* delegate_;
399 400
400 // VisitedLinkEventListener to handle incoming events. 401 // VisitedLinkEventListener to handle incoming events.
401 scoped_ptr<Listener> listener_; 402 std::unique_ptr<Listener> listener_;
402 403
403 // Lazily initialized sequence token for posting file tasks. 404 // Lazily initialized sequence token for posting file tasks.
404 base::SequencedWorkerPool::SequenceToken sequence_token_; 405 base::SequencedWorkerPool::SequenceToken sequence_token_;
405 406
406 // When non-NULL, indicates we are in database rebuild mode and points to 407 // When non-NULL, indicates we are in database rebuild mode and points to
407 // the class collecting fingerprint information from the history system. 408 // the class collecting fingerprint information from the history system.
408 // The pointer is owned by this class, but it must remain valid while the 409 // The pointer is owned by this class, but it must remain valid while the
409 // history query is running. We must only delete it when the query is done. 410 // history query is running. We must only delete it when the query is done.
410 scoped_refptr<TableBuilder> table_builder_; 411 scoped_refptr<TableBuilder> table_builder_;
411 412
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 if (hash_table_[i]) 485 if (hash_table_[i])
485 used_count++; 486 used_count++;
486 } 487 }
487 DCHECK_EQ(used_count, used_items_); 488 DCHECK_EQ(used_count, used_items_);
488 } 489 }
489 #endif 490 #endif
490 491
491 } // namespace visitedlink 492 } // namespace visitedlink
492 493
493 #endif // COMPONENTS_VISITEDLINK_BROWSER_VISITEDLINK_MASTER_H_ 494 #endif // COMPONENTS_VISITEDLINK_BROWSER_VISITEDLINK_MASTER_H_
OLDNEW
« no previous file with comments | « components/version_ui/version_handler_helper.cc ('k') | components/visitedlink/browser/visitedlink_master.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698