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

Side by Side Diff: webkit/plugins/npapi/webplugin_delegate_impl_win.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 "webkit/plugins/npapi/webplugin_delegate_impl.h" 5 #include "webkit/plugins/npapi/webplugin_delegate_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // Flash displays popups in response to user clicks by posting a WM_USER 63 // Flash displays popups in response to user clicks by posting a WM_USER
64 // message to the plugin window. The handler for this message displays 64 // message to the plugin window. The handler for this message displays
65 // the popup. To ensure that the popups allowed state is sent correctly 65 // the popup. To ensure that the popups allowed state is sent correctly
66 // to the renderer we reset the popups allowed state in a timer. 66 // to the renderer we reset the popups allowed state in a timer.
67 const int kWindowedPluginPopupTimerMs = 50; 67 const int kWindowedPluginPopupTimerMs = 50;
68 68
69 // The current instance of the plugin which entered the modal loop. 69 // The current instance of the plugin which entered the modal loop.
70 WebPluginDelegateImpl* g_current_plugin_instance = NULL; 70 WebPluginDelegateImpl* g_current_plugin_instance = NULL;
71 71
72 typedef std::deque<MSG> ThrottleQueue; 72 typedef std::deque<MSG> ThrottleQueue;
73 base::LazyInstance<ThrottleQueue> g_throttle_queue(base::LINKER_INITIALIZED); 73 base::LazyInstance<ThrottleQueue> g_throttle_queue = LAZY_INSTANCE_INITIALIZER;
74 base::LazyInstance<std::map<HWND, WNDPROC> > g_window_handle_proc_map(
75 base::LINKER_INITIALIZED);
76 74
75 base::LazyInstance<std::map<HWND, WNDPROC> > g_window_handle_proc_map =
76 LAZY_INSTANCE_INITIALIZER;
77 77
78 // Helper object for patching the TrackPopupMenu API. 78 // Helper object for patching the TrackPopupMenu API.
79 base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_track_popup_menu( 79 base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_track_popup_menu =
80 base::LINKER_INITIALIZED); 80 LAZY_INSTANCE_INITIALIZER;
81 81
82 // Helper object for patching the SetCursor API. 82 // Helper object for patching the SetCursor API.
83 base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_set_cursor( 83 base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_set_cursor =
84 base::LINKER_INITIALIZED); 84 LAZY_INSTANCE_INITIALIZER;
85 85
86 // Helper object for patching the RegEnumKeyExW API. 86 // Helper object for patching the RegEnumKeyExW API.
87 base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_reg_enum_key_ex_w( 87 base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_reg_enum_key_ex_w =
88 base::LINKER_INITIALIZED); 88 LAZY_INSTANCE_INITIALIZER;
89 89
90 // Helper object for patching the GetProcAddress API. 90 // Helper object for patching the GetProcAddress API.
91 base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_get_proc_address( 91 base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_get_proc_address =
92 base::LINKER_INITIALIZED); 92 LAZY_INSTANCE_INITIALIZER;
93 93
94 // Helper object for patching the GetKeyState API. 94 // Helper object for patching the GetKeyState API.
95 base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_get_key_state( 95 base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_get_key_state =
96 base::LINKER_INITIALIZED); 96 LAZY_INSTANCE_INITIALIZER;
97 97
98 // Saved key state globals and helper access functions. 98 // Saved key state globals and helper access functions.
99 SHORT (WINAPI *g_iat_orig_get_key_state)(int vkey); 99 SHORT (WINAPI *g_iat_orig_get_key_state)(int vkey);
100 typedef size_t SavedStateType; 100 typedef size_t SavedStateType;
101 const size_t kBitsPerType = sizeof(SavedStateType) * 8; 101 const size_t kBitsPerType = sizeof(SavedStateType) * 8;
102 // Bit array of key state corresponding to virtual key index (0=up, 1=down). 102 // Bit array of key state corresponding to virtual key index (0=up, 1=down).
103 SavedStateType g_saved_key_state[256 / kBitsPerType]; 103 SavedStateType g_saved_key_state[256 / kBitsPerType];
104 104
105 bool GetSavedKeyState(WPARAM vkey) { 105 bool GetSavedKeyState(WPARAM vkey) {
106 CHECK_LT(vkey, kBitsPerType * sizeof(g_saved_key_state)); 106 CHECK_LT(vkey, kBitsPerType * sizeof(g_saved_key_state));
(...skipping 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after
1563 ::ReleaseCapture(); 1563 ::ReleaseCapture();
1564 break; 1564 break;
1565 1565
1566 default: 1566 default:
1567 break; 1567 break;
1568 } 1568 }
1569 } 1569 }
1570 1570
1571 } // namespace npapi 1571 } // namespace npapi
1572 } // namespace webkit 1572 } // namespace webkit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698