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

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: 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
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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 CallJavascriptFunction("printPreviewFailed"); 238 CallJavascriptFunction("printPreviewFailed");
239 } 239 }
240 240
241 void PrintPreviewUI::OnInvalidPrinterSettings() { 241 void PrintPreviewUI::OnInvalidPrinterSettings() {
242 CallJavascriptFunction("invalidPrinterSettings"); 242 CallJavascriptFunction("invalidPrinterSettings");
243 } 243 }
244 244
245 PrintPreviewDataService* PrintPreviewUI::print_preview_data_service() { 245 PrintPreviewDataService* PrintPreviewUI::print_preview_data_service() {
246 return PrintPreviewDataService::GetInstance(); 246 return PrintPreviewDataService::GetInstance();
247 } 247 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/html_dialog_ui.cc ('k') | chrome/browser/ui/webui/web_ui_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698