diff options
author | cpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-21 18:41:44 +0000 |
---|---|---|
committer | cpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-21 18:41:44 +0000 |
commit | 192bae97dc70dae27bf536e76e127b0ca9572283 (patch) | |
tree | 90e33b05fe7196765c2865d6405489fd642336af /chrome/common/child_process_logging_win.cc | |
parent | dda06f8f233dcc895085d219b58355137d8fa3b1 (diff) | |
download | chromium_src-192bae97dc70dae27bf536e76e127b0ca9572283.zip chromium_src-192bae97dc70dae27bf536e76e127b0ca9572283.tar.gz chromium_src-192bae97dc70dae27bf536e76e127b0ca9572283.tar.bz2 |
Added a static function pointer to cache the SetActiveURL pointer.
- Windows only change.
This is basically landing jschuh change http://codereview.chromium.org/293040
TEST=none
BUG=25366
Review URL: http://codereview.chromium.org/313009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29677 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/child_process_logging_win.cc')
-rw-r--r-- | chrome/common/child_process_logging_win.cc | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/chrome/common/child_process_logging_win.cc b/chrome/common/child_process_logging_win.cc index 2221713..e8ddd02 100644 --- a/chrome/common/child_process_logging_win.cc +++ b/chrome/common/child_process_logging_win.cc @@ -11,19 +11,21 @@ #include "googleurl/src/gurl.h" namespace child_process_logging { - +// exported in breakpad_win.cc: void __declspec(dllexport) __cdecl SetActiveURL. typedef void (__cdecl *MainSetActiveURL)(const wchar_t*); void SetActiveURL(const GURL& url) { - HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); - if (!exe_module) - return; - - MainSetActiveURL set_active_url = - reinterpret_cast<MainSetActiveURL>( - GetProcAddress(exe_module, "SetActiveURL")); - if (!set_active_url) - return; + static MainSetActiveURL set_active_url = NULL; + // note: benign race condition on set_active_url. + if (!set_active_url) { + HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); + if (!exe_module) + return; + set_active_url = reinterpret_cast<MainSetActiveURL>( + GetProcAddress(exe_module, "SetActiveURL")); + if (!set_active_url) + return; + } (set_active_url)(UTF8ToWide(url.possibly_invalid_spec()).c_str()); } |