| OLD | NEW |
| 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 #include "chrome_frame/test/perf/chrome_frame_perftest.h" | 5 #include "chrome_frame/test/perf/chrome_frame_perftest.h" |
| 5 | 6 |
| 6 #include <atlhost.h> | 7 #include <atlhost.h> |
| 7 #include <atlwin.h> | 8 #include <atlwin.h> |
| 8 | 9 |
| 9 #include <map> | 10 #include <map> |
| 10 #include <string> | 11 #include <string> |
| 11 #include <vector> | 12 #include <vector> |
| 12 | 13 |
| 13 #include "base/debug/trace_event_win.h" | 14 #include "base/debug/trace_event_win.h" |
| 14 #include "base/file_util.h" | 15 #include "base/file_util.h" |
| 15 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
| 16 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/path_service.h" | 18 #include "base/path_service.h" |
| 18 #include "base/process/kill.h" | 19 #include "base/process/kill.h" |
| 19 #include "base/process/launch.h" | 20 #include "base/process/launch.h" |
| 20 #include "base/process/process_iterator.h" | 21 #include "base/process/process_iterator.h" |
| 21 #include "base/strings/string_util.h" | 22 #include "base/strings/string_util.h" |
| 22 #include "base/strings/stringprintf.h" | 23 #include "base/strings/stringprintf.h" |
| 23 #include "base/strings/utf_string_conversions.h" | 24 #include "base/strings/utf_string_conversions.h" |
| 25 #include "base/test/perf_time_logger.h" |
| 24 #include "base/test/test_file_util.h" | 26 #include "base/test/test_file_util.h" |
| 25 #include "base/threading/platform_thread.h" | 27 #include "base/threading/platform_thread.h" |
| 26 #include "base/time/time.h" | 28 #include "base/time/time.h" |
| 27 #include "base/win/event_trace_consumer.h" | 29 #include "base/win/event_trace_consumer.h" |
| 28 #include "base/win/event_trace_controller.h" | 30 #include "base/win/event_trace_controller.h" |
| 29 #include "base/win/registry.h" | 31 #include "base/win/registry.h" |
| 30 #include "base/win/scoped_bstr.h" | 32 #include "base/win/scoped_bstr.h" |
| 31 #include "base/win/scoped_comptr.h" | 33 #include "base/win/scoped_comptr.h" |
| 32 #include "base/win/scoped_variant.h" | 34 #include "base/win/scoped_variant.h" |
| 33 #include "chrome/app/image_pre_reader_win.h" | 35 #include "chrome/app/image_pre_reader_win.h" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 }; | 225 }; |
| 224 | 226 |
| 225 // This class overrides the hooks provided by the ChromeFrameActiveXContainer | 227 // This class overrides the hooks provided by the ChromeFrameActiveXContainer |
| 226 // class and measures performance at various stages, like initialzation of | 228 // class and measures performance at various stages, like initialzation of |
| 227 // the Chrome frame widget, navigation, etc. | 229 // the Chrome frame widget, navigation, etc. |
| 228 class ChromeFrameActiveXContainerPerf : public ChromeFrameActiveXContainer { | 230 class ChromeFrameActiveXContainerPerf : public ChromeFrameActiveXContainer { |
| 229 public: | 231 public: |
| 230 ChromeFrameActiveXContainerPerf() {} | 232 ChromeFrameActiveXContainerPerf() {} |
| 231 | 233 |
| 232 void CreateControl(bool setup_event_sinks) { | 234 void CreateControl(bool setup_event_sinks) { |
| 233 perf_initialize_.reset(new PerfTimeLogger("Fully initialized")); | 235 perf_initialize_.reset(new base::PerfTimeLogger("Fully initialized")); |
| 234 PerfTimeLogger perf_create("Create Control"); | 236 base::PerfTimeLogger perf_create("Create Control"); |
| 235 | 237 |
| 236 HRESULT hr = chromeview_.CreateControl(L"ChromeTab.ChromeFrame"); | 238 HRESULT hr = chromeview_.CreateControl(L"ChromeTab.ChromeFrame"); |
| 237 EXPECT_HRESULT_SUCCEEDED(hr); | 239 EXPECT_HRESULT_SUCCEEDED(hr); |
| 238 hr = chromeview_.QueryControl(tab_.Receive()); | 240 hr = chromeview_.QueryControl(tab_.Receive()); |
| 239 EXPECT_HRESULT_SUCCEEDED(hr); | 241 EXPECT_HRESULT_SUCCEEDED(hr); |
| 240 | 242 |
| 241 perf_create.Done(); | 243 perf_create.Done(); |
| 242 if (setup_event_sinks) | 244 if (setup_event_sinks) |
| 243 SetupEventSinks(); | 245 SetupEventSinks(); |
| 244 } | 246 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 265 } | 267 } |
| 266 | 268 |
| 267 virtual void OnLoadErrorCallbackImpl(const VARIANT* param) { | 269 virtual void OnLoadErrorCallbackImpl(const VARIANT* param) { |
| 268 PostMessage(WM_CLOSE); | 270 PostMessage(WM_CLOSE); |
| 269 perf_navigate_->Done(); | 271 perf_navigate_->Done(); |
| 270 } | 272 } |
| 271 | 273 |
| 272 virtual void BeforeNavigateImpl(const char* url ) { | 274 virtual void BeforeNavigateImpl(const char* url ) { |
| 273 std::string test_name = "Navigate "; | 275 std::string test_name = "Navigate "; |
| 274 test_name += url; | 276 test_name += url; |
| 275 perf_navigate_.reset(new PerfTimeLogger(test_name.c_str())); | 277 perf_navigate_.reset(new base::PerfTimeLogger(test_name.c_str())); |
| 276 } | 278 } |
| 277 | 279 |
| 278 scoped_ptr<PerfTimeLogger> perf_initialize_; | 280 scoped_ptr<base::PerfTimeLogger> perf_initialize_; |
| 279 scoped_ptr<PerfTimeLogger> perf_navigate_; | 281 scoped_ptr<base::PerfTimeLogger> perf_navigate_; |
| 280 }; | 282 }; |
| 281 | 283 |
| 282 // This class provides common functionality which can be used for most of the | 284 // This class provides common functionality which can be used for most of the |
| 283 // ChromeFrame/Tab performance tests. | 285 // ChromeFrame/Tab performance tests. |
| 284 class ChromeFramePerfTestBase : public UIPerfTest { | 286 class ChromeFramePerfTestBase : public UIPerfTest { |
| 285 public: | 287 public: |
| 286 ChromeFramePerfTestBase() {} | 288 ChromeFramePerfTestBase() {} |
| 287 protected: | 289 protected: |
| 288 scoped_ptr<ScopedChromeFrameRegistrar> chrome_frame_registrar_; | 290 scoped_ptr<ScopedChromeFrameRegistrar> chrome_frame_registrar_; |
| 289 }; | 291 }; |
| (...skipping 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1600 PrintPerfTestResults(automation_provider_connect_monitor, kNumCycles, | 1602 PrintPerfTestResults(automation_provider_connect_monitor, kNumCycles, |
| 1601 "automationproviderconnect"); | 1603 "automationproviderconnect"); |
| 1602 PrintPerfTestResults(external_tab_navigate_monitor, kNumCycles, | 1604 PrintPerfTestResults(external_tab_navigate_monitor, kNumCycles, |
| 1603 "externaltabnavigate"); | 1605 "externaltabnavigate"); |
| 1604 PrintPerfTestResults(renderer_main_monitor, kNumCycles, | 1606 PrintPerfTestResults(renderer_main_monitor, kNumCycles, |
| 1605 "beginrenderermain"); | 1607 "beginrenderermain"); |
| 1606 #ifdef NDEBUG | 1608 #ifdef NDEBUG |
| 1607 PrintPerfTestResults(pre_read_chrome_monitor, kNumCycles, "PreReadImage"); | 1609 PrintPerfTestResults(pre_read_chrome_monitor, kNumCycles, "PreReadImage"); |
| 1608 #endif // NDEBUG | 1610 #endif // NDEBUG |
| 1609 } | 1611 } |
| OLD | NEW |