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

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: fix CrOS 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(LINKER_ZERO_INITIALIZED;
74 base::LazyInstance<std::map<HWND, WNDPROC> > g_window_handle_proc_map( 74 base::LazyInstance<std::map<HWND, WNDPROC> > g_window_handle_proc_map =
75 base::LINKER_INITIALIZED); 75 LINKER_ZERO_INITIALIZED;
76
77 76
78 // Helper object for patching the TrackPopupMenu API. 77 // Helper object for patching the TrackPopupMenu API.
79 base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_track_popup_menu( 78 base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_track_popup_menu =
80 base::LINKER_INITIALIZED); 79 LINKER_ZERO_INITIALIZED;
81 80
82 // Helper object for patching the SetCursor API. 81 // Helper object for patching the SetCursor API.
83 base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_set_cursor( 82 base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_set_cursor =
84 base::LINKER_INITIALIZED); 83 LINKER_ZERO_INITIALIZED;
85 84
86 // Helper object for patching the RegEnumKeyExW API. 85 // Helper object for patching the RegEnumKeyExW API.
87 base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_reg_enum_key_ex_w( 86 base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_reg_enum_key_ex_w =
88 base::LINKER_INITIALIZED); 87 LINKER_ZERO_INITIALIZED;
89 88
90 // Helper object for patching the GetProcAddress API. 89 // Helper object for patching the GetProcAddress API.
91 base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_get_proc_address( 90 base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_get_proc_address =
92 base::LINKER_INITIALIZED); 91 LINKER_ZERO_INITIALIZED;
93 92
94 // Helper object for patching the GetKeyState API. 93 // Helper object for patching the GetKeyState API.
95 base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_get_key_state( 94 base::LazyInstance<base::win::IATPatchFunction> g_iat_patch_get_key_state =
96 base::LINKER_INITIALIZED); 95 LINKER_ZERO_INITIALIZED;
97 96
98 // Saved key state globals and helper access functions. 97 // Saved key state globals and helper access functions.
99 SHORT (WINAPI *g_iat_orig_get_key_state)(int vkey); 98 SHORT (WINAPI *g_iat_orig_get_key_state)(int vkey);
100 typedef size_t SavedStateType; 99 typedef size_t SavedStateType;
101 const size_t kBitsPerType = sizeof(SavedStateType) * 8; 100 const size_t kBitsPerType = sizeof(SavedStateType) * 8;
102 // Bit array of key state corresponding to virtual key index (0=up, 1=down). 101 // Bit array of key state corresponding to virtual key index (0=up, 1=down).
103 SavedStateType g_saved_key_state[256 / kBitsPerType]; 102 SavedStateType g_saved_key_state[256 / kBitsPerType];
104 103
105 bool GetSavedKeyState(WPARAM vkey) { 104 bool GetSavedKeyState(WPARAM vkey) {
106 CHECK_LT(vkey, kBitsPerType * sizeof(g_saved_key_state)); 105 CHECK_LT(vkey, kBitsPerType * sizeof(g_saved_key_state));
(...skipping 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after
1563 ::ReleaseCapture(); 1562 ::ReleaseCapture();
1564 break; 1563 break;
1565 1564
1566 default: 1565 default:
1567 break; 1566 break;
1568 } 1567 }
1569 } 1568 }
1570 1569
1571 } // namespace npapi 1570 } // namespace npapi
1572 } // namespace webkit 1571 } // namespace webkit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698