Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/plugin/PluginClass.h

Issue 29332665: Issue #3391 - Initialize themed drawing variables using DetachedInitializer
Patch Set: Created Dec. 14, 2015, 6:06 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/plugin/PluginClass.cpp » ('j') | src/plugin/PluginClass.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 11 matching lines...) Expand all
22 #ifndef _PLUGIN_CLASS_H_ 22 #ifndef _PLUGIN_CLASS_H_
23 #define _PLUGIN_CLASS_H_ 23 #define _PLUGIN_CLASS_H_
24 24
25 25
26 #include "Plugin.h" 26 #include "Plugin.h"
27 #include "PluginTabBase.h" 27 #include "PluginTabBase.h"
28 #define _CRTDBG_MAP_ALLOC 28 #define _CRTDBG_MAP_ALLOC
29 #include <stdlib.h> 29 #include <stdlib.h>
30 #include <crtdbg.h> 30 #include <crtdbg.h>
31 #include <set> 31 #include <set>
32
33 #include "NotificationMessage.h" 32 #include "NotificationMessage.h"
33 #include "DetachedInitialization.h"
34 34
35 #define ICON_PLUGIN_DISABLED 0 35 #define ICON_PLUGIN_DISABLED 0
36 #define ICON_PLUGIN_ENABLED 1 36 #define ICON_PLUGIN_ENABLED 1
37 #define ICON_PLUGIN_DEACTIVATED 2 37 #define ICON_PLUGIN_DEACTIVATED 2
38 #define ICON_MAX 3 38 #define ICON_MAX 3
39 39
40 #define WM_LAUNCH_INFO (WM_APP + 10) 40 #define WM_LAUNCH_INFO (WM_APP + 10)
41 41
42 class CPluginMimeFilterClient; 42 class CPluginMimeFilterClient;
43 43
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 bool IsRootBrowser(IWebBrowser2*); 105 bool IsRootBrowser(IWebBrowser2*);
106 106
107 static CPluginMimeFilterClient* s_mimeFilter; 107 static CPluginMimeFilterClient* s_mimeFilter;
108 108
109 private: 109 private:
110 110
111 std::wstring GetBrowserUrl() const; 111 std::wstring GetBrowserUrl() const;
112 112
113 static DWORD WINAPI StartInitObject(LPVOID thisPtr); 113 static DWORD WINAPI StartInitObject(LPVOID thisPtr);
114 bool InitObject(); 114 bool InitObject();
115 void CloseTheme();
116 void UpdateTheme(); 115 void UpdateTheme();
117 116
118 static HICON GetStatusBarIcon(const std::wstring& url); 117 static HICON GetStatusBarIcon(const std::wstring& url);
119 static CPluginClass* FindInstance(HWND hStatusBarWnd); 118 static CPluginClass* FindInstance(HWND hStatusBarWnd);
120 static LRESULT CALLBACK NewStatusProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); 119 static LRESULT CALLBACK NewStatusProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
121 static LRESULT CALLBACK PaneWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); 120 static LRESULT CALLBACK PaneWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
122 static void FirstRunThread(); 121 static void FirstRunThread();
123 122
124 void STDMETHODCALLTYPE OnBeforeNavigate2(IDispatch* pDisp /**< [in] */, 123 void STDMETHODCALLTYPE OnBeforeNavigate2(IDispatch* pDisp /**< [in] */,
125 VARIANT* URL /**< [in] */, 124 VARIANT* URL /**< [in] */,
126 VARIANT* Flags /**< [in] */, 125 VARIANT* Flags /**< [in] */,
127 VARIANT* TargetFrameName /**< [in] */ , 126 VARIANT* TargetFrameName /**< [in] */ ,
128 VARIANT* PostData /**< [in] */, 127 VARIANT* PostData /**< [in] */,
129 VARIANT* Headers /**< [in] */, 128 VARIANT* Headers /**< [in] */,
130 VARIANT_BOOL* Cancel /* [in, out] */) ; 129 VARIANT_BOOL* Cancel /* [in, out] */) ;
131 void STDMETHODCALLTYPE OnDownloadComplete(); 130 void STDMETHODCALLTYPE OnDownloadComplete();
132 void STDMETHODCALLTYPE OnDocumentComplete(IDispatch* frameBrowserDisp, VARIANT * /*urlOrPidl*/); 131 void STDMETHODCALLTYPE OnDocumentComplete(IDispatch* frameBrowserDisp, VARIANT * /*urlOrPidl*/);
133 void STDMETHODCALLTYPE OnWindowStateChanged(unsigned long flags, unsigned long validFlagsMask); 132 void STDMETHODCALLTYPE OnWindowStateChanged(unsigned long flags, unsigned long validFlagsMask);
134 void STDMETHODCALLTYPE OnCommandStateChange(long command, VARIANT_BOOL enable) ; 133 void STDMETHODCALLTYPE OnCommandStateChange(long command, VARIANT_BOOL enable) ;
135 void STDMETHODCALLTYPE OnOnQuit(); 134 void STDMETHODCALLTYPE OnOnQuit();
136 void Unadvise(); 135 void Unadvise();
137 136
138 void ShowStatusBar(); 137 void ShowStatusBar();
139 bool IsStatusBarEnabled(); 138 bool IsStatusBarEnabled();
139
140 static void Initializer();
141 typedef DetachedInitializer<Initializer> DetachedInitializerType;
142 static DetachedInitializerType di;
143 inline static void EnsureInitialized() { di.EnsureInitialized(); }
140 144
141 /** 145 /**
142 * A browser interface pointer to our site object 146 * A browser interface pointer to our site object
143 * 147 *
144 * It's values are set and reset solely in SetSite(). 148 * It's values are set and reset solely in SetSite().
145 */ 149 */
146 CComPtr<IWebBrowser2> m_webBrowser2; 150 CComPtr<IWebBrowser2> m_webBrowser2;
147 HWND m_hBrowserWnd; 151 HWND m_hBrowserWnd;
148 HWND m_hTabWnd; 152 HWND m_hTabWnd;
149 HWND m_hStatusBarWnd; 153 HWND m_hStatusBarWnd;
(...skipping 18 matching lines...) Expand all
168 // Icons 172 // Icons
169 static HICON s_hIcons[ICON_MAX]; 173 static HICON s_hIcons[ICON_MAX];
170 static DWORD s_hIconTypes[ICON_MAX]; 174 static DWORD s_hIconTypes[ICON_MAX];
171 175
172 static HICON GetIcon(int type); 176 static HICON GetIcon(int type);
173 177
174 // Main thread 178 // Main thread
175 static HANDLE s_hMainThread; 179 static HANDLE s_hMainThread;
176 static bool s_isMainThreadDone; 180 static bool s_isMainThreadDone;
177 181
178 static HINSTANCE s_hUxtheme;
179 static std::set<CPluginClass*> s_instances; 182 static std::set<CPluginClass*> s_instances;
180 static std::map<DWORD,CPluginClass*> s_threadInstances; 183 static std::map<DWORD,CPluginClass*> s_threadInstances;
181 static CComAutoCriticalSection s_criticalSectionLocal; 184 static CComAutoCriticalSection s_criticalSectionLocal;
182 static CComAutoCriticalSection s_criticalSectionWindow; 185 static CComAutoCriticalSection s_criticalSectionWindow;
183 186
184 // Async browser 187 // Async browser
185 static CComQIPtr<IWebBrowser2> s_asyncWebBrowser2; 188 static CComQIPtr<IWebBrowser2> s_asyncWebBrowser2;
186 static CComQIPtr<IWebBrowser2> GetAsyncBrowser(); 189 static CComQIPtr<IWebBrowser2> GetAsyncBrowser();
187 }; 190 };
188 191
189 OBJECT_ENTRY_AUTO(__uuidof(PluginClass), CPluginClass) 192 OBJECT_ENTRY_AUTO(__uuidof(PluginClass), CPluginClass)
190 193
191 194
192 #endif // _PLUGIN_CLASS_H_ 195 #endif // _PLUGIN_CLASS_H_
OLDNEW
« no previous file with comments | « no previous file | src/plugin/PluginClass.cpp » ('j') | src/plugin/PluginClass.cpp » ('J')

Powered by Google App Engine
This is Rietveld