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

Side by Side Diff: net/url_request/url_request.cc

Issue 8491043: Allow linker initialization of lazy instance (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: willchan comments + rebase Created 9 years, 1 month 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 | « net/tools/fetch/fetch_client.cc ('k') | net/url_request/url_request_test_job.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 #include "net/url_request/url_request.h" 5 #include "net/url_request/url_request.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } 51 }
52 52
53 // TODO(battre): Delete this, see http://crbug.com/89321: 53 // TODO(battre): Delete this, see http://crbug.com/89321:
54 // This counter keeps track of the identifiers used for URL requests so far. 54 // This counter keeps track of the identifiers used for URL requests so far.
55 // 0 is reserved to represent an invalid ID. 55 // 0 is reserved to represent an invalid ID.
56 uint64 g_next_url_request_identifier = 1; 56 uint64 g_next_url_request_identifier = 1;
57 57
58 // This lock protects g_next_url_request_identifier. 58 // This lock protects g_next_url_request_identifier.
59 base::LazyInstance<base::Lock, 59 base::LazyInstance<base::Lock,
60 base::LeakyLazyInstanceTraits<base::Lock> > 60 base::LeakyLazyInstanceTraits<base::Lock> >
61 g_next_url_request_identifier_lock(base::LINKER_INITIALIZED); 61 g_next_url_request_identifier_lock = LAZY_INSTANCE_INITIALIZER;
62 62
63 // Returns an prior unused identifier for URL requests. 63 // Returns an prior unused identifier for URL requests.
64 uint64 GenerateURLRequestIdentifier() { 64 uint64 GenerateURLRequestIdentifier() {
65 base::AutoLock lock(g_next_url_request_identifier_lock.Get()); 65 base::AutoLock lock(g_next_url_request_identifier_lock.Get());
66 return g_next_url_request_identifier++; 66 return g_next_url_request_identifier++;
67 } 67 }
68 68
69 } // namespace 69 } // namespace
70 70
71 URLRequest::ProtocolFactory* 71 URLRequest::ProtocolFactory*
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 892
893 void URLRequest::SetUnblockedOnDelegate() { 893 void URLRequest::SetUnblockedOnDelegate() {
894 if (!blocked_on_delegate_) 894 if (!blocked_on_delegate_)
895 return; 895 return;
896 blocked_on_delegate_ = false; 896 blocked_on_delegate_ = false;
897 load_state_param_.clear(); 897 load_state_param_.clear();
898 net_log_.EndEvent(NetLog::TYPE_URL_REQUEST_BLOCKED_ON_DELEGATE, NULL); 898 net_log_.EndEvent(NetLog::TYPE_URL_REQUEST_BLOCKED_ON_DELEGATE, NULL);
899 } 899 }
900 900
901 } // namespace net 901 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/fetch/fetch_client.cc ('k') | net/url_request/url_request_test_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698