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

Side by Side Diff: chrome/browser/ui/webui/print_preview_ui.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 #include "chrome/browser/ui/webui/print_preview_ui.h" 5 #include "chrome/browser/ui/webui/print_preview_ui.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 private: 56 private:
57 typedef std::map<std::string, int> PrintPreviewRequestIdMap; 57 typedef std::map<std::string, int> PrintPreviewRequestIdMap;
58 58
59 PrintPreviewRequestIdMap map_; 59 PrintPreviewRequestIdMap map_;
60 base::Lock lock_; 60 base::Lock lock_;
61 }; 61 };
62 62
63 // Written to on the UI thread, read from any thread. 63 // Written to on the UI thread, read from any thread.
64 base::LazyInstance<PrintPreviewRequestIdMapWithLock> 64 base::LazyInstance<PrintPreviewRequestIdMapWithLock>
65 g_print_preview_request_id_map(base::LINKER_INITIALIZED); 65 g_print_preview_request_id_map = LAZY_INSTANCE_INITIALIZER;
66 66
67 } // namespace 67 } // namespace
68 68
69 PrintPreviewUI::PrintPreviewUI(TabContents* contents) 69 PrintPreviewUI::PrintPreviewUI(TabContents* contents)
70 : ChromeWebUI(contents), 70 : ChromeWebUI(contents),
71 initial_preview_start_time_(base::TimeTicks::Now()) { 71 initial_preview_start_time_(base::TimeTicks::Now()) {
72 // WebUI owns |handler_|. 72 // WebUI owns |handler_|.
73 handler_ = new PrintPreviewHandler(); 73 handler_ = new PrintPreviewHandler();
74 AddMessageHandler(handler_->Attach(this)); 74 AddMessageHandler(handler_->Attach(this));
75 75
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 CallJavascriptFunction("printPreviewFailed"); 236 CallJavascriptFunction("printPreviewFailed");
237 } 237 }
238 238
239 void PrintPreviewUI::OnInvalidPrinterSettings() { 239 void PrintPreviewUI::OnInvalidPrinterSettings() {
240 CallJavascriptFunction("invalidPrinterSettings"); 240 CallJavascriptFunction("invalidPrinterSettings");
241 } 241 }
242 242
243 PrintPreviewDataService* PrintPreviewUI::print_preview_data_service() { 243 PrintPreviewDataService* PrintPreviewUI::print_preview_data_service() {
244 return PrintPreviewDataService::GetInstance(); 244 return PrintPreviewDataService::GetInstance();
245 } 245 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698