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

Side by Side Diff: content/browser/download/save_item.cc

Issue 1529363006: Introducing SavePackageId and SaveItemId as distinct IdType<...>-based types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed CR feedback from Daniel. Created 4 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
« no previous file with comments | « content/browser/download/save_item.h ('k') | content/browser/download/save_package.h » ('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) 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 #include "content/browser/download/save_item.h" 5 #include "content/browser/download/save_item.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "content/browser/download/save_file.h" 9 #include "content/browser/download/save_file.h"
10 #include "content/browser/download/save_file_manager.h" 10 #include "content/browser/download/save_file_manager.h"
11 #include "content/browser/download/save_package.h" 11 #include "content/browser/download/save_package.h"
12 #include "content/public/browser/browser_thread.h" 12 #include "content/public/browser/browser_thread.h"
13 13
14 namespace content { 14 namespace content {
15 15
16 namespace { 16 namespace {
17 17
18 int GetNextSaveItemId() { 18 SaveItemId GetNextSaveItemId() {
19 static int g_next_save_item_id = 0; 19 static int g_next_save_item_id = 1;
20 DCHECK_CURRENTLY_ON(BrowserThread::UI); 20 DCHECK_CURRENTLY_ON(BrowserThread::UI);
21 return g_next_save_item_id++; 21 return SaveItemId::FromUnsafeValue(g_next_save_item_id++);
22 } 22 }
23 23
24 } // namespace 24 } // namespace
25 25
26 // Constructor for SaveItem when creating each saving job. 26 // Constructor for SaveItem when creating each saving job.
27 SaveItem::SaveItem(const GURL& url, 27 SaveItem::SaveItem(const GURL& url,
28 const Referrer& referrer, 28 const Referrer& referrer,
29 SavePackage* package, 29 SavePackage* package,
30 SaveFileCreateInfo::SaveFileSource save_source) 30 SaveFileCreateInfo::SaveFileSource save_source)
31 : save_item_id_(GetNextSaveItemId()), 31 : save_item_id_(GetNextSaveItemId()),
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 file_name_ = full_path_.BaseName(); 121 file_name_ = full_path_.BaseName();
122 has_final_name_ = true; 122 has_final_name_ = true;
123 } 123 }
124 124
125 void SaveItem::SetTotalBytes(int64_t total_bytes) { 125 void SaveItem::SetTotalBytes(int64_t total_bytes) {
126 DCHECK_EQ(0, total_bytes_); 126 DCHECK_EQ(0, total_bytes_);
127 total_bytes_ = total_bytes; 127 total_bytes_ = total_bytes;
128 } 128 }
129 129
130 } // namespace content 130 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/save_item.h ('k') | content/browser/download/save_package.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698