Chromium Code Reviews| Index: content/browser/download/download_id_factory.cc |
| diff --git a/content/browser/download/download_id_factory.cc b/content/browser/download/download_id_factory.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..637b483795803dc53c4537710c64db8479da515f |
| --- /dev/null |
| +++ b/content/browser/download/download_id_factory.cc |
| @@ -0,0 +1,22 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "content/browser/download/download_id_factory.h" |
| + |
| +#include "content/browser/download/download_id.h" |
| + |
| +DownloadIdFactory::DownloadIdFactory(DownloadId::Domain domain) |
| + : domain_(domain), |
| + next_id_(0) { |
| +} |
| + |
| +DownloadId DownloadIdFactory::GetNextId() { |
| + base::AutoLock lock(lock_); |
|
Randy Smith (Not in Mondays)
2011/10/27 18:01:44
Is there a reason to use AutoLock rather than atom
benjhayden
2011/10/27 19:04:41
We're planning on initializing next_id_ to somethi
|
| + return DownloadId(domain_, next_id_++); |
| +} |
| + |
| +void DownloadIdFactory::SetNextId(int next_id) { |
| + base::AutoLock lock(lock_); |
| + next_id_ += next_id; |
|
Randy Smith (Not in Mondays)
2011/10/27 18:01:44
The += is strange enough that it deserves a commen
benjhayden
2011/10/27 19:04:41
We were thinking at one point that DM could alloca
|
| +} |