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

Side by Side Diff: chrome_frame/bho.cc

Issue 10704017: Adding Chrome Frame metric for SetSite performance. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 HRESULT Bho::FinalConstruct() { 66 HRESULT Bho::FinalConstruct() {
66 return S_OK; 67 return S_OK;
67 } 68 }
68 69
69 void Bho::FinalRelease() { 70 void Bho::FinalRelease() {
70 } 71 }
71 72
72 STDMETHODIMP Bho::SetSite(IUnknown* site) { 73 STDMETHODIMP Bho::SetSite(IUnknown* site) {
73 HRESULT hr = S_OK; 74 HRESULT hr = S_OK;
74 if (site) { 75 if (site) {
76 base::TimeTicks start = base::TimeTicks::Now();
75 base::win::ScopedComPtr<IWebBrowser2> web_browser2; 77 base::win::ScopedComPtr<IWebBrowser2> web_browser2;
76 web_browser2.QueryFrom(site); 78 web_browser2.QueryFrom(site);
77 if (web_browser2) { 79 if (web_browser2) {
78 hr = DispEventAdvise(web_browser2, &DIID_DWebBrowserEvents2); 80 hr = DispEventAdvise(web_browser2, &DIID_DWebBrowserEvents2);
79 DCHECK(SUCCEEDED(hr)) << "DispEventAdvise failed. Error: " << hr; 81 DCHECK(SUCCEEDED(hr)) << "DispEventAdvise failed. Error: " << hr;
80 } 82 }
81 83
82 if (g_patch_helper.state() == PatchHelper::PATCH_IBROWSER) { 84 if (g_patch_helper.state() == PatchHelper::PATCH_IBROWSER) {
83 base::win::ScopedComPtr<IBrowserService> browser_service; 85 base::win::ScopedComPtr<IBrowserService> browser_service;
84 hr = DoQueryService(SID_SShellBrowser, site, browser_service.Receive()); 86 hr = DoQueryService(SID_SShellBrowser, site, browser_service.Receive());
85 DCHECK(browser_service) << "DoQueryService - SID_SShellBrowser failed." 87 DCHECK(browser_service) << "DoQueryService - SID_SShellBrowser failed."
86 << " Site: " << site << " Error: " << hr; 88 << " Site: " << site << " Error: " << hr;
87 if (browser_service) { 89 if (browser_service) {
88 g_patch_helper.PatchBrowserService(browser_service); 90 g_patch_helper.PatchBrowserService(browser_service);
89 DCHECK(SUCCEEDED(hr)) << "vtable_patch::PatchInterfaceMethods failed." 91 DCHECK(SUCCEEDED(hr)) << "vtable_patch::PatchInterfaceMethods failed."
90 << " Site: " << site << " Error: " << hr; 92 << " Site: " << site << " Error: " << hr;
91 } 93 }
92 } 94 }
93 // Save away our BHO instance in TLS which enables it to be referenced by 95 // Save away our BHO instance in TLS which enables it to be referenced by
94 // our active document/activex instances to query referrer and other 96 // our active document/activex instances to query referrer and other
95 // information for a URL. 97 // information for a URL.
96 AddRef(); 98 AddRef();
97 RegisterThreadInstance(); 99 RegisterThreadInstance();
98 MetricsService::Start(); 100 MetricsService::Start();
99 101
100 if (!IncreaseWinInetConnections(kMaxHttpConnections)) { 102 if (!IncreaseWinInetConnections(kMaxHttpConnections)) {
101 DLOG(WARNING) << "Failed to bump up HTTP connections. Error:" 103 DLOG(WARNING) << "Failed to bump up HTTP connections. Error:"
102 << ::GetLastError(); 104 << ::GetLastError();
103 } 105 }
106
107 base::TimeDelta delta = base::TimeTicks::Now() - start;
108 UMA_HISTOGRAM_TIMES("ChromeFrame.BhoLoadSetSite", delta);
104 } else { 109 } else {
105 UnregisterThreadInstance(); 110 UnregisterThreadInstance();
106 buggy_bho::BuggyBhoTls::DestroyInstance(); 111 buggy_bho::BuggyBhoTls::DestroyInstance();
107 base::win::ScopedComPtr<IWebBrowser2> web_browser2; 112 base::win::ScopedComPtr<IWebBrowser2> web_browser2;
108 web_browser2.QueryFrom(m_spUnkSite); 113 web_browser2.QueryFrom(m_spUnkSite);
109 DispEventUnadvise(web_browser2, &DIID_DWebBrowserEvents2); 114 DispEventUnadvise(web_browser2, &DIID_DWebBrowserEvents2);
110 Release(); 115 Release();
111 } 116 }
112 117
113 return IObjectWithSiteImpl<Bho>::SetSite(site); 118 return IObjectWithSiteImpl<Bho>::SetSite(site);
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 } 354 }
350 } 355 }
351 356
352 void PatchHelper::UnpatchIfNeeded() { 357 void PatchHelper::UnpatchIfNeeded() {
353 if (state_ == PATCH_PROTOCOL) { 358 if (state_ == PATCH_PROTOCOL) {
354 g_trans_hooks.RevertHooks(); 359 g_trans_hooks.RevertHooks();
355 HttpNegotiatePatch::Uninitialize(); 360 HttpNegotiatePatch::Uninitialize();
356 } 361 }
357 state_ = UNKNOWN; 362 state_ = UNKNOWN;
358 } 363 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698