Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
|
grt (UTC plus 2)
2012/06/28 13:55:04
2012
robertshield
2012/06/28 14:11:14
Done.
| |
| 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 "chrome_frame/bho.h" | 5 #include "chrome_frame/bho.h" |
| 6 | 6 |
| 7 #include <shlguid.h> | 7 #include <shlguid.h> |
| 8 | 8 |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "base/stringprintf.h" | 13 #include "base/stringprintf.h" |
| 14 #include "base/time.h" | |
| 14 #include "base/win/scoped_bstr.h" | 15 #include "base/win/scoped_bstr.h" |
| 15 #include "chrome_frame/buggy_bho_handling.h" | 16 #include "chrome_frame/buggy_bho_handling.h" |
| 16 #include "chrome_frame/crash_reporting/crash_metrics.h" | 17 #include "chrome_frame/crash_reporting/crash_metrics.h" |
| 17 #include "chrome_frame/extra_system_apis.h" | 18 #include "chrome_frame/extra_system_apis.h" |
| 18 #include "chrome_frame/html_utils.h" | 19 #include "chrome_frame/html_utils.h" |
| 19 #include "chrome_frame/http_negotiate.h" | 20 #include "chrome_frame/http_negotiate.h" |
| 20 #include "chrome_frame/metrics_service.h" | 21 #include "chrome_frame/metrics_service.h" |
| 21 #include "chrome_frame/protocol_sink_wrap.h" | 22 #include "chrome_frame/protocol_sink_wrap.h" |
| 22 #include "chrome_frame/ready_mode/ready_mode.h" | 23 #include "chrome_frame/ready_mode/ready_mode.h" |
| 23 #include "chrome_frame/urlmon_moniker.h" | 24 #include "chrome_frame/urlmon_moniker.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 85 }; // class ReadyModeDelegateImpl | 86 }; // class ReadyModeDelegateImpl |
| 86 | 87 |
| 87 void ReadyModeDelegateImpl::DisableChromeFrame() { | 88 void ReadyModeDelegateImpl::DisableChromeFrame() { |
| 88 HttpNegotiatePatch::set_modify_user_agent(false); | 89 HttpNegotiatePatch::set_modify_user_agent(false); |
| 89 ProtocolSinkWrap::set_ignore_xua(true); | 90 ProtocolSinkWrap::set_ignore_xua(true); |
| 90 } | 91 } |
| 91 | 92 |
| 92 } // namespace | 93 } // namespace |
| 93 | 94 |
| 94 STDMETHODIMP Bho::SetSite(IUnknown* site) { | 95 STDMETHODIMP Bho::SetSite(IUnknown* site) { |
| 96 base::TimeTicks start = base::TimeTicks::Now(); | |
|
grt (UTC plus 2)
2012/06/28 13:55:04
move this down to line 100?
robertshield
2012/06/28 14:11:14
Done.
| |
| 97 | |
| 95 HRESULT hr = S_OK; | 98 HRESULT hr = S_OK; |
| 96 if (site) { | 99 if (site) { |
| 97 base::win::ScopedComPtr<IWebBrowser2> web_browser2; | 100 base::win::ScopedComPtr<IWebBrowser2> web_browser2; |
| 98 web_browser2.QueryFrom(site); | 101 web_browser2.QueryFrom(site); |
| 99 if (web_browser2) { | 102 if (web_browser2) { |
| 100 hr = DispEventAdvise(web_browser2, &DIID_DWebBrowserEvents2); | 103 hr = DispEventAdvise(web_browser2, &DIID_DWebBrowserEvents2); |
| 101 DCHECK(SUCCEEDED(hr)) << "DispEventAdvise failed. Error: " << hr; | 104 DCHECK(SUCCEEDED(hr)) << "DispEventAdvise failed. Error: " << hr; |
| 102 | 105 |
| 103 ready_mode::Configure(new ReadyModeDelegateImpl(), web_browser2); | 106 ready_mode::Configure(new ReadyModeDelegateImpl(), web_browser2); |
| 104 } | 107 } |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 118 // our active document/activex instances to query referrer and other | 121 // our active document/activex instances to query referrer and other |
| 119 // information for a URL. | 122 // information for a URL. |
| 120 AddRef(); | 123 AddRef(); |
| 121 RegisterThreadInstance(); | 124 RegisterThreadInstance(); |
| 122 MetricsService::Start(); | 125 MetricsService::Start(); |
| 123 | 126 |
| 124 if (!IncreaseWinInetConnections(kMaxHttpConnections)) { | 127 if (!IncreaseWinInetConnections(kMaxHttpConnections)) { |
| 125 DLOG(WARNING) << "Failed to bump up HTTP connections. Error:" | 128 DLOG(WARNING) << "Failed to bump up HTTP connections. Error:" |
| 126 << ::GetLastError(); | 129 << ::GetLastError(); |
| 127 } | 130 } |
| 131 | |
| 132 base::TimeDelta delta = base::TimeTicks::Now() - start; | |
| 133 UMA_HISTOGRAM_TIMES("ChromeFrame.BhoLoadSetSite", delta); | |
|
grt (UTC plus 2)
2012/06/28 13:55:04
delta.InMilliseconds()
robertshield
2012/06/28 14:11:14
The macro already does that.
| |
| 128 } else { | 134 } else { |
| 129 UnregisterThreadInstance(); | 135 UnregisterThreadInstance(); |
| 130 buggy_bho::BuggyBhoTls::DestroyInstance(); | 136 buggy_bho::BuggyBhoTls::DestroyInstance(); |
| 131 base::win::ScopedComPtr<IWebBrowser2> web_browser2; | 137 base::win::ScopedComPtr<IWebBrowser2> web_browser2; |
| 132 web_browser2.QueryFrom(m_spUnkSite); | 138 web_browser2.QueryFrom(m_spUnkSite); |
| 133 DispEventUnadvise(web_browser2, &DIID_DWebBrowserEvents2); | 139 DispEventUnadvise(web_browser2, &DIID_DWebBrowserEvents2); |
| 134 Release(); | 140 Release(); |
| 135 } | 141 } |
| 136 | 142 |
| 137 return IObjectWithSiteImpl<Bho>::SetSite(site); | 143 return IObjectWithSiteImpl<Bho>::SetSite(site); |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 373 } | 379 } |
| 374 } | 380 } |
| 375 | 381 |
| 376 void PatchHelper::UnpatchIfNeeded() { | 382 void PatchHelper::UnpatchIfNeeded() { |
| 377 if (state_ == PATCH_PROTOCOL) { | 383 if (state_ == PATCH_PROTOCOL) { |
| 378 g_trans_hooks.RevertHooks(); | 384 g_trans_hooks.RevertHooks(); |
| 379 HttpNegotiatePatch::Uninitialize(); | 385 HttpNegotiatePatch::Uninitialize(); |
| 380 } | 386 } |
| 381 state_ = UNKNOWN; | 387 state_ = UNKNOWN; |
| 382 } | 388 } |
| OLD | NEW |