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

Side by Side Diff: chrome/browser/safe_browsing/malware_details.cc

Issue 8491043: Allow linker initialization of lazy instance (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: thakis comment, renamed LAZY_INSTANCE_INITIALIZER 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
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 // Implementation of the MalwareDetails class. 5 // Implementation of the MalwareDetails class.
6 6
7 #include "chrome/browser/safe_browsing/malware_details.h" 7 #include "chrome/browser/safe_browsing/malware_details.h"
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 private: 47 private:
48 friend struct base::DefaultLazyInstanceTraits< 48 friend struct base::DefaultLazyInstanceTraits<
49 MalwareDetailsFactoryImpl>; 49 MalwareDetailsFactoryImpl>;
50 50
51 MalwareDetailsFactoryImpl() { } 51 MalwareDetailsFactoryImpl() { }
52 52
53 DISALLOW_COPY_AND_ASSIGN(MalwareDetailsFactoryImpl); 53 DISALLOW_COPY_AND_ASSIGN(MalwareDetailsFactoryImpl);
54 }; 54 };
55 55
56 static base::LazyInstance<MalwareDetailsFactoryImpl> 56 static base::LazyInstance<MalwareDetailsFactoryImpl>
57 g_malware_details_factory_impl(base::LINKER_INITIALIZED); 57 g_malware_details_factory_impl = LAZY_INSTANCE_INITIALIZER;
58 58
59 // Create a MalwareDetails for the given tab. 59 // Create a MalwareDetails for the given tab.
60 /* static */ 60 /* static */
61 MalwareDetails* MalwareDetails::NewMalwareDetails( 61 MalwareDetails* MalwareDetails::NewMalwareDetails(
62 SafeBrowsingService* sb_service, 62 SafeBrowsingService* sb_service,
63 TabContents* tab_contents, 63 TabContents* tab_contents,
64 const SafeBrowsingService::UnsafeResource& resource) { 64 const SafeBrowsingService::UnsafeResource& resource) {
65 // Set up the factory if this has not been done already (tests do that 65 // Set up the factory if this has not been done already (tests do that
66 // before this method is called). 66 // before this method is called).
67 if (!factory_) 67 if (!factory_)
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 302
303 // Send the report, using the SafeBrowsingService. 303 // Send the report, using the SafeBrowsingService.
304 std::string serialized; 304 std::string serialized;
305 if (!report_->SerializeToString(&serialized)) { 305 if (!report_->SerializeToString(&serialized)) {
306 DLOG(ERROR) << "Unable to serialize the malware report."; 306 DLOG(ERROR) << "Unable to serialize the malware report.";
307 return; 307 return;
308 } 308 }
309 309
310 sb_service_->SendSerializedMalwareDetails(serialized); 310 sb_service_->SendSerializedMalwareDetails(serialized);
311 } 311 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698