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

Unified Diff: base/message_pump_win.cc

Issue 10407011: Making sure that base::MessagePumpForUI from different modules are isolated from each other. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR feedback Created 8 years, 7 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/message_pump_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_pump_win.cc
diff --git a/base/message_pump_win.cc b/base/message_pump_win.cc
index 9484b29e67c5cc00bd98e92e18a34e4f10e43c6b..fc65d849426ae669958895d3ea47455db324f83a 100644
--- a/base/message_pump_win.cc
+++ b/base/message_pump_win.cc
@@ -8,6 +8,7 @@
#include "base/message_loop.h"
#include "base/metrics/histogram.h"
+#include "base/process_util.h"
#include "base/win/wrapped_window_proc.h"
namespace base {
@@ -82,13 +83,13 @@ int MessagePumpWin::GetCurrentDelay() const {
//-----------------------------------------------------------------------------
// MessagePumpForUI public:
-MessagePumpForUI::MessagePumpForUI() {
+MessagePumpForUI::MessagePumpForUI() : instance_(NULL) {
InitMessageWnd();
}
MessagePumpForUI::~MessagePumpForUI() {
DestroyWindow(message_hwnd_);
- UnregisterClass(kWndClass, GetModuleHandle(NULL));
+ UnregisterClass(kWndClass, instance_);
}
void MessagePumpForUI::ScheduleWork() {
@@ -230,17 +231,16 @@ void MessagePumpForUI::DoRunLoop() {
}
void MessagePumpForUI::InitMessageWnd() {
- HINSTANCE hinst = GetModuleHandle(NULL);
-
WNDCLASSEX wc = {0};
wc.cbSize = sizeof(wc);
wc.lpfnWndProc = base::win::WrappedWindowProc<WndProcThunk>;
- wc.hInstance = hinst;
+ wc.hInstance = base::GetModuleFromAddress(wc.lpfnWndProc);
wc.lpszClassName = kWndClass;
+ instance_ = wc.hInstance;
RegisterClassEx(&wc);
message_hwnd_ =
- CreateWindow(kWndClass, 0, 0, 0, 0, 0, 0, HWND_MESSAGE, 0, hinst, 0);
+ CreateWindow(kWndClass, 0, 0, 0, 0, 0, 0, HWND_MESSAGE, 0, instance_, 0);
DCHECK(message_hwnd_);
}
« no previous file with comments | « base/message_pump_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698