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 |
5 #include "chrome/renderer/page_load_histograms.h" | 5 #include "chrome/renderer/page_load_histograms.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/metrics/field_trial.h" | 12 #include "base/metrics/field_trial.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
15 #include "base/strings/string_split.h" | 15 #include "base/strings/string_split.h" |
16 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
17 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
20 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
21 #include "chrome/renderer/chrome_content_renderer_client.h" | 21 #include "chrome/renderer/chrome_content_renderer_client.h" |
22 #include "chrome/renderer/searchbox/search_bouncer.h" | 22 #include "chrome/renderer/searchbox/search_bouncer.h" |
23 #include "components/data_reduction_proxy/content/common/data_reduction_proxy_me ssages.h" | 23 #include "components/data_reduction_proxy/content/common/data_reduction_proxy_me ssages.h" |
24 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h" | |
24 #include "content/public/common/content_constants.h" | 25 #include "content/public/common/content_constants.h" |
25 #include "content/public/renderer/document_state.h" | 26 #include "content/public/renderer/document_state.h" |
26 #include "content/public/renderer/render_thread.h" | 27 #include "content/public/renderer/render_thread.h" |
27 #include "content/public/renderer/render_view.h" | 28 #include "content/public/renderer/render_view.h" |
28 #include "extensions/common/url_pattern.h" | 29 #include "extensions/common/url_pattern.h" |
29 #include "net/base/url_util.h" | 30 #include "net/base/url_util.h" |
30 #include "net/http/http_response_headers.h" | 31 #include "net/http/http_response_headers.h" |
31 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 32 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
32 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 33 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
33 #include "third_party/WebKit/public/web/WebDocument.h" | 34 #include "third_party/WebKit/public/web/WebDocument.h" |
34 #include "third_party/WebKit/public/web/WebFrame.h" | 35 #include "third_party/WebKit/public/web/WebFrame.h" |
35 #include "third_party/WebKit/public/web/WebPerformance.h" | 36 #include "third_party/WebKit/public/web/WebPerformance.h" |
36 #include "third_party/WebKit/public/web/WebView.h" | 37 #include "third_party/WebKit/public/web/WebView.h" |
37 #include "url/gurl.h" | 38 #include "url/gurl.h" |
38 | 39 |
39 using blink::WebDataSource; | 40 using blink::WebDataSource; |
40 using blink::WebFrame; | 41 using blink::WebFrame; |
41 using blink::WebPerformance; | 42 using blink::WebPerformance; |
42 using blink::WebString; | 43 using blink::WebString; |
43 using base::Time; | 44 using base::Time; |
44 using base::TimeDelta; | 45 using base::TimeDelta; |
45 using content::DocumentState; | 46 using content::DocumentState; |
46 | 47 |
47 const size_t kPLTCount = 100; | 48 const size_t kPLTCount = 100; |
48 | 49 |
49 namespace { | 50 namespace { |
50 | 51 |
52 const char kEnabled[] = "Enabled"; | |
53 const char kControl[] = "Control"; | |
54 | |
51 // ID indicating that no GWS-Chrome joint experiment is active. | 55 // ID indicating that no GWS-Chrome joint experiment is active. |
52 const int kNoExperiment = 0; | 56 const int kNoExperiment = 0; |
53 | 57 |
54 // Max ID of GWS-Chrome joint experiment. If you change this value, please | 58 // Max ID of GWS-Chrome joint experiment. If you change this value, please |
55 // update PLT_HISTOGRAM_WITH_GWS_VARIANT accordingly. | 59 // update PLT_HISTOGRAM_WITH_GWS_VARIANT accordingly. |
56 const int kMaxExperimentID = 20; | 60 const int kMaxExperimentID = 20; |
57 | 61 |
58 TimeDelta kPLTMin() { | 62 TimeDelta kPLTMin() { |
59 return TimeDelta::FromMilliseconds(10); | 63 return TimeDelta::FromMilliseconds(10); |
60 } | 64 } |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
212 if (!base::StringToInt(value, &experiment_id)) | 216 if (!base::StringToInt(value, &experiment_id)) |
213 return kNoExperiment; | 217 return kNoExperiment; |
214 if (0 < experiment_id && experiment_id <= kMaxExperimentID) | 218 if (0 < experiment_id && experiment_id <= kMaxExperimentID) |
215 return experiment_id; | 219 return experiment_id; |
216 return kNoExperiment; | 220 return kNoExperiment; |
217 } | 221 } |
218 | 222 |
219 void DumpHistograms(const WebPerformance& performance, | 223 void DumpHistograms(const WebPerformance& performance, |
220 DocumentState* document_state, | 224 DocumentState* document_state, |
221 bool data_reduction_proxy_was_used, | 225 bool data_reduction_proxy_was_used, |
222 data_reduction_proxy::LoFiStatus lofi_status, | 226 bool lofi_on, |
223 bool came_from_websearch, | 227 bool came_from_websearch, |
224 int websearch_chrome_joint_experiment_id, | 228 int websearch_chrome_joint_experiment_id, |
225 bool is_preview, | 229 bool is_preview, |
226 URLPattern::SchemeMasks scheme_type) { | 230 URLPattern::SchemeMasks scheme_type) { |
227 // This function records new histograms based on the Navigation Timing | 231 // This function records new histograms based on the Navigation Timing |
228 // records. As such, the histograms should not depend on the deprecated timing | 232 // records. As such, the histograms should not depend on the deprecated timing |
229 // information collected in DocumentState. However, here for some reason we | 233 // information collected in DocumentState. However, here for some reason we |
230 // check if document_state->request_time() is null. TODO(ppi): find out why | 234 // check if document_state->request_time() is null. TODO(ppi): find out why |
231 // and remove DocumentState from the parameter list. | 235 // and remove DocumentState from the parameter list. |
232 Time request = document_state->request_time(); | 236 Time request = document_state->request_time(); |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
404 load_event_end - navigation_start, | 408 load_event_end - navigation_start, |
405 came_from_websearch, | 409 came_from_websearch, |
406 websearch_chrome_joint_experiment_id, | 410 websearch_chrome_joint_experiment_id, |
407 is_preview); | 411 is_preview); |
408 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_StartToFinish", | 412 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_StartToFinish", |
409 load_event_end - request_start, | 413 load_event_end - request_start, |
410 came_from_websearch, | 414 came_from_websearch, |
411 websearch_chrome_joint_experiment_id, | 415 websearch_chrome_joint_experiment_id, |
412 is_preview); | 416 is_preview); |
413 if (data_reduction_proxy_was_used) { | 417 if (data_reduction_proxy_was_used) { |
418 bool in_lofi_enabled = | |
bengr
2015/08/25 00:00:01
Rename as in_lofi_enabled_group, or lofi_available
megjablon
2015/08/25 20:29:45
Done.
| |
419 (base::FieldTrialList::FindFullName( | |
420 data_reduction_proxy::params::GetLoFiFieldTrialName()) == | |
421 kEnabled); | |
422 bool in_lofi_control = | |
bengr
2015/08/25 00:00:01
Rename as in_lofi_control_group, or lofi_control_g
megjablon
2015/08/25 20:29:45
Done.
| |
423 (base::FieldTrialList::FindFullName( | |
424 data_reduction_proxy::params::GetLoFiFieldTrialName()) == | |
425 kControl); | |
414 if ((scheme_type & URLPattern::SCHEME_HTTPS) == 0) { | 426 if ((scheme_type & URLPattern::SCHEME_HTTPS) == 0) { |
415 PLT_HISTOGRAM("PLT.PT_BeginToFinish_DataReductionProxy", | 427 PLT_HISTOGRAM("PLT.PT_BeginToFinish_DataReductionProxy", |
416 load_event_end - begin); | 428 load_event_end - begin); |
417 PLT_HISTOGRAM("PLT.PT_CommitToFinish_DataReductionProxy", | 429 PLT_HISTOGRAM("PLT.PT_CommitToFinish_DataReductionProxy", |
418 load_event_end - response_start); | 430 load_event_end - response_start); |
419 PLT_HISTOGRAM("PLT.PT_RequestToFinish_DataReductionProxy", | 431 PLT_HISTOGRAM("PLT.PT_RequestToFinish_DataReductionProxy", |
420 load_event_end - navigation_start); | 432 load_event_end - navigation_start); |
421 PLT_HISTOGRAM("PLT.PT_StartToFinish_DataReductionProxy", | 433 PLT_HISTOGRAM("PLT.PT_StartToFinish_DataReductionProxy", |
422 load_event_end - request_start); | 434 load_event_end - request_start); |
423 if (lofi_status == data_reduction_proxy::LOFI_STATUS_ACTIVE) { | 435 if (lofi_on && in_lofi_enabled) { |
424 PLT_HISTOGRAM("PLT.PT_BeginToFinish_DataReductionProxy_AutoLoFiOn", | 436 PLT_HISTOGRAM("PLT.PT_BeginToFinish_DataReductionProxy_AutoLoFiOn", |
425 load_event_end - begin); | 437 load_event_end - begin); |
426 PLT_HISTOGRAM("PLT.PT_CommitToFinish_DataReductionProxy_AutoLoFiOn", | 438 PLT_HISTOGRAM("PLT.PT_CommitToFinish_DataReductionProxy_AutoLoFiOn", |
427 load_event_end - response_start); | 439 load_event_end - response_start); |
428 PLT_HISTOGRAM("PLT.PT_RequestToFinish_DataReductionProxy_AutoLoFiOn", | 440 PLT_HISTOGRAM("PLT.PT_RequestToFinish_DataReductionProxy_AutoLoFiOn", |
429 load_event_end - navigation_start); | 441 load_event_end - navigation_start); |
430 PLT_HISTOGRAM("PLT.PT_StartToFinish_DataReductionProxy_AutoLoFiOn", | 442 PLT_HISTOGRAM("PLT.PT_StartToFinish_DataReductionProxy_AutoLoFiOn", |
431 load_event_end - request_start); | 443 load_event_end - request_start); |
432 if (!first_paint.is_null()) { | 444 if (!first_paint.is_null()) { |
433 PLT_HISTOGRAM("PLT.BeginToFirstPaint_DataReductionProxy_AutoLoFiOn", | 445 PLT_HISTOGRAM("PLT.BeginToFirstPaint_DataReductionProxy_AutoLoFiOn", |
434 first_paint - begin); | 446 first_paint - begin); |
435 } | 447 } |
436 } else if (lofi_status == | 448 } else if (lofi_on && in_lofi_control) { |
437 data_reduction_proxy::LOFI_STATUS_ACTIVE_CONTROL) { | |
438 PLT_HISTOGRAM("PLT.PT_BeginToFinish_DataReductionProxy_AutoLoFiOff", | 449 PLT_HISTOGRAM("PLT.PT_BeginToFinish_DataReductionProxy_AutoLoFiOff", |
439 load_event_end - begin); | 450 load_event_end - begin); |
440 PLT_HISTOGRAM("PLT.PT_CommitToFinish_DataReductionProxy_AutoLoFiOff", | 451 PLT_HISTOGRAM("PLT.PT_CommitToFinish_DataReductionProxy_AutoLoFiOff", |
441 load_event_end - response_start); | 452 load_event_end - response_start); |
442 PLT_HISTOGRAM("PLT.PT_RequestToFinish_DataReductionProxy_AutoLoFiOff", | 453 PLT_HISTOGRAM("PLT.PT_RequestToFinish_DataReductionProxy_AutoLoFiOff", |
443 load_event_end - navigation_start); | 454 load_event_end - navigation_start); |
444 PLT_HISTOGRAM("PLT.PT_StartToFinish_DataReductionProxy_AutoLoFiOff", | 455 PLT_HISTOGRAM("PLT.PT_StartToFinish_DataReductionProxy_AutoLoFiOff", |
445 load_event_end - request_start); | 456 load_event_end - request_start); |
446 if (!first_paint.is_null()) { | 457 if (!first_paint.is_null()) { |
447 PLT_HISTOGRAM( | 458 PLT_HISTOGRAM( |
448 "PLT.BeginToFirstPaint_DataReductionProxy_AutoLoFiOff", | 459 "PLT.BeginToFirstPaint_DataReductionProxy_AutoLoFiOff", |
449 first_paint - begin); | 460 first_paint - begin); |
450 } | 461 } |
451 } | 462 } |
452 } else { | 463 } else { |
453 PLT_HISTOGRAM("PLT.PT_BeginToFinish_HTTPS_DataReductionProxy", | 464 PLT_HISTOGRAM("PLT.PT_BeginToFinish_HTTPS_DataReductionProxy", |
454 load_event_end - begin); | 465 load_event_end - begin); |
455 PLT_HISTOGRAM("PLT.PT_CommitToFinish_HTTPS_DataReductionProxy", | 466 PLT_HISTOGRAM("PLT.PT_CommitToFinish_HTTPS_DataReductionProxy", |
456 load_event_end - response_start); | 467 load_event_end - response_start); |
457 PLT_HISTOGRAM("PLT.PT_RequestToFinish_HTTPS_DataReductionProxy", | 468 PLT_HISTOGRAM("PLT.PT_RequestToFinish_HTTPS_DataReductionProxy", |
458 load_event_end - navigation_start); | 469 load_event_end - navigation_start); |
459 PLT_HISTOGRAM("PLT.PT_StartToFinish_HTTPS_DataReductionProxy", | 470 PLT_HISTOGRAM("PLT.PT_StartToFinish_HTTPS_DataReductionProxy", |
460 load_event_end - request_start); | 471 load_event_end - request_start); |
461 if (lofi_status == data_reduction_proxy::LOFI_STATUS_ACTIVE) { | 472 if (lofi_on && in_lofi_enabled) { |
462 PLT_HISTOGRAM( | 473 PLT_HISTOGRAM( |
463 "PLT.PT_BeginToFinish_HTTPS_DataReductionProxy_AutoLoFiOn", | 474 "PLT.PT_BeginToFinish_HTTPS_DataReductionProxy_AutoLoFiOn", |
464 load_event_end - begin); | 475 load_event_end - begin); |
465 PLT_HISTOGRAM( | 476 PLT_HISTOGRAM( |
466 "PLT.PT_CommitToFinish_HTTPS_DataReductionProxy_AutoLoFiOn", | 477 "PLT.PT_CommitToFinish_HTTPS_DataReductionProxy_AutoLoFiOn", |
467 load_event_end - response_start); | 478 load_event_end - response_start); |
468 PLT_HISTOGRAM( | 479 PLT_HISTOGRAM( |
469 "PLT.PT_RequestToFinish_HTTPS_DataReductionProxy_AutoLoFiOn", | 480 "PLT.PT_RequestToFinish_HTTPS_DataReductionProxy_AutoLoFiOn", |
470 load_event_end - navigation_start); | 481 load_event_end - navigation_start); |
471 PLT_HISTOGRAM( | 482 PLT_HISTOGRAM( |
472 "PLT.PT_StartToFinish_HTTPS_DataReductionProxy_AutoLoFiOn", | 483 "PLT.PT_StartToFinish_HTTPS_DataReductionProxy_AutoLoFiOn", |
473 load_event_end - request_start); | 484 load_event_end - request_start); |
474 if (!first_paint.is_null()) { | 485 if (!first_paint.is_null()) { |
475 PLT_HISTOGRAM( | 486 PLT_HISTOGRAM( |
476 "PLT.BeginToFirstPaint_HTTPS_DataReductionProxy_AutoLoFiOn", | 487 "PLT.BeginToFirstPaint_HTTPS_DataReductionProxy_AutoLoFiOn", |
477 first_paint - begin); | 488 first_paint - begin); |
478 } | 489 } |
479 } else if (lofi_status == | 490 } else if (lofi_on && in_lofi_control) { |
480 data_reduction_proxy::LOFI_STATUS_ACTIVE_CONTROL) { | |
481 PLT_HISTOGRAM( | 491 PLT_HISTOGRAM( |
482 "PLT.PT_BeginToFinish_HTTPS_DataReductionProxy_AutoLoFiOff", | 492 "PLT.PT_BeginToFinish_HTTPS_DataReductionProxy_AutoLoFiOff", |
483 load_event_end - begin); | 493 load_event_end - begin); |
484 PLT_HISTOGRAM( | 494 PLT_HISTOGRAM( |
485 "PLT.PT_CommitToFinish_HTTPS_DataReductionProxy_AutoLoFiOff", | 495 "PLT.PT_CommitToFinish_HTTPS_DataReductionProxy_AutoLoFiOff", |
486 load_event_end - response_start); | 496 load_event_end - response_start); |
487 PLT_HISTOGRAM( | 497 PLT_HISTOGRAM( |
488 "PLT.PT_RequestToFinish_HTTPS_DataReductionProxy_AutoLoFiOff", | 498 "PLT.PT_RequestToFinish_HTTPS_DataReductionProxy_AutoLoFiOff", |
489 load_event_end - navigation_start); | 499 load_event_end - navigation_start); |
490 PLT_HISTOGRAM( | 500 PLT_HISTOGRAM( |
(...skipping 26 matching lines...) Expand all Loading... | |
517 } | 527 } |
518 } | 528 } |
519 } | 529 } |
520 if (!dom_content_loaded_start.is_null()) { | 530 if (!dom_content_loaded_start.is_null()) { |
521 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToDomContentLoaded", | 531 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToDomContentLoaded", |
522 dom_content_loaded_start - navigation_start, | 532 dom_content_loaded_start - navigation_start, |
523 came_from_websearch, | 533 came_from_websearch, |
524 websearch_chrome_joint_experiment_id, | 534 websearch_chrome_joint_experiment_id, |
525 is_preview); | 535 is_preview); |
526 if (data_reduction_proxy_was_used) { | 536 if (data_reduction_proxy_was_used) { |
537 bool in_lofi_enabled = | |
538 (base::FieldTrialList::FindFullName( | |
539 data_reduction_proxy::params::GetLoFiFieldTrialName()) == | |
540 kEnabled); | |
541 bool in_lofi_control = | |
542 (base::FieldTrialList::FindFullName( | |
543 data_reduction_proxy::params::GetLoFiFieldTrialName()) == | |
bengr
2015/08/25 00:00:01
It's probably worth the extra few lines of code to
megjablon
2015/08/25 20:29:45
Done.
| |
544 kControl); | |
527 if ((scheme_type & URLPattern::SCHEME_HTTPS) == 0) { | 545 if ((scheme_type & URLPattern::SCHEME_HTTPS) == 0) { |
528 PLT_HISTOGRAM("PLT.PT_RequestToDomContentLoaded_DataReductionProxy", | 546 PLT_HISTOGRAM("PLT.PT_RequestToDomContentLoaded_DataReductionProxy", |
529 dom_content_loaded_start - navigation_start); | 547 dom_content_loaded_start - navigation_start); |
530 if (lofi_status == data_reduction_proxy::LOFI_STATUS_ACTIVE) { | 548 if (lofi_on && in_lofi_enabled) { |
531 PLT_HISTOGRAM( | 549 PLT_HISTOGRAM( |
532 "PLT.PT_RequestToDomContentLoaded_DataReductionProxy_AutoLoFiOn", | 550 "PLT.PT_RequestToDomContentLoaded_DataReductionProxy_AutoLoFiOn", |
533 dom_content_loaded_start - navigation_start); | 551 dom_content_loaded_start - navigation_start); |
534 } else if (lofi_status == | 552 } else if (lofi_on && in_lofi_control) { |
535 data_reduction_proxy::LOFI_STATUS_ACTIVE_CONTROL) { | |
536 PLT_HISTOGRAM( | 553 PLT_HISTOGRAM( |
537 "PLT.PT_RequestToDomContentLoaded_DataReductionProxy_AutoLoFiOff", | 554 "PLT.PT_RequestToDomContentLoaded_DataReductionProxy_AutoLoFiOff", |
538 dom_content_loaded_start - navigation_start); | 555 dom_content_loaded_start - navigation_start); |
539 } | 556 } |
540 } else { | 557 } else { |
541 PLT_HISTOGRAM( | 558 PLT_HISTOGRAM( |
542 "PLT.PT_RequestToDomContentLoaded_HTTPS_DataReductionProxy", | 559 "PLT.PT_RequestToDomContentLoaded_HTTPS_DataReductionProxy", |
543 dom_content_loaded_start - navigation_start); | 560 dom_content_loaded_start - navigation_start); |
544 if (lofi_status == data_reduction_proxy::LOFI_STATUS_ACTIVE) { | 561 if (lofi_on && in_lofi_enabled) { |
545 PLT_HISTOGRAM( | 562 PLT_HISTOGRAM( |
546 "PLT.PT_RequestToDomContentLoaded_HTTPS_DataReductionProxy_" | 563 "PLT.PT_RequestToDomContentLoaded_HTTPS_DataReductionProxy_" |
547 "AutoLoFiOn", | 564 "AutoLoFiOn", |
548 dom_content_loaded_start - navigation_start); | 565 dom_content_loaded_start - navigation_start); |
549 } else if (lofi_status == | 566 } else if (lofi_on && in_lofi_control) { |
550 data_reduction_proxy::LOFI_STATUS_ACTIVE_CONTROL) { | |
551 PLT_HISTOGRAM( | 567 PLT_HISTOGRAM( |
552 "PLT.PT_RequestToDomContentLoaded_HTTPS_DataReductionProxy_" | 568 "PLT.PT_RequestToDomContentLoaded_HTTPS_DataReductionProxy_" |
553 "AutoLoFiOff", | 569 "AutoLoFiOff", |
554 dom_content_loaded_start - navigation_start); | 570 dom_content_loaded_start - navigation_start); |
555 } | 571 } |
556 } | 572 } |
557 } | 573 } |
558 } | 574 } |
559 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_BeginToCommit", | 575 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_BeginToCommit", |
560 response_start - begin, | 576 response_start - begin, |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
860 return false; | 876 return false; |
861 } | 877 } |
862 | 878 |
863 // Ignore multipart requests. | 879 // Ignore multipart requests. |
864 if (frame->dataSource()->response().isMultipartPayload()) | 880 if (frame->dataSource()->response().isMultipartPayload()) |
865 return false; | 881 return false; |
866 | 882 |
867 return true; | 883 return true; |
868 } | 884 } |
869 | 885 |
870 void PageLoadHistograms::Dump(WebFrame* frame) { | 886 void PageLoadHistograms::Dump(WebFrame* frame, bool lofi_used) { |
871 if (!ShouldDump(frame)) | 887 if (!ShouldDump(frame)) |
872 return; | 888 return; |
873 | 889 |
874 URLPattern::SchemeMasks scheme_type = | 890 URLPattern::SchemeMasks scheme_type = |
875 GetSupportedSchemeType(frame->document().url()); | 891 GetSupportedSchemeType(frame->document().url()); |
876 | 892 |
877 DocumentState* document_state = | 893 DocumentState* document_state = |
878 DocumentState::FromDataSource(frame->dataSource()); | 894 DocumentState::FromDataSource(frame->dataSource()); |
879 | 895 |
880 bool data_reduction_proxy_was_used = false; | 896 bool data_reduction_proxy_was_used = false; |
881 data_reduction_proxy::LoFiStatus lofi_status = | |
882 data_reduction_proxy::LOFI_STATUS_TEMPORARILY_OFF; | |
883 if (!document_state->proxy_server().IsEmpty()) { | 897 if (!document_state->proxy_server().IsEmpty()) { |
884 Send(new DataReductionProxyViewHostMsg_DataReductionProxyStatus( | 898 Send(new DataReductionProxyViewHostMsg_DataReductionProxyStatus( |
885 document_state->proxy_server(), &data_reduction_proxy_was_used, | 899 document_state->proxy_server(), &data_reduction_proxy_was_used)); |
886 &lofi_status)); | |
887 } | 900 } |
888 | 901 |
889 bool came_from_websearch = | 902 bool came_from_websearch = |
890 IsFromGoogleSearchResult(frame->document().url(), | 903 IsFromGoogleSearchResult(frame->document().url(), |
891 GURL(frame->document().referrer())); | 904 GURL(frame->document().referrer())); |
892 int websearch_chrome_joint_experiment_id = kNoExperiment; | 905 int websearch_chrome_joint_experiment_id = kNoExperiment; |
893 bool is_preview = false; | 906 bool is_preview = false; |
894 if (came_from_websearch) { | 907 if (came_from_websearch) { |
895 websearch_chrome_joint_experiment_id = | 908 websearch_chrome_joint_experiment_id = |
896 GetQueryStringBasedExperiment(GURL(frame->document().referrer())); | 909 GetQueryStringBasedExperiment(GURL(frame->document().referrer())); |
897 is_preview = ViaHeaderContains(frame, "1.1 Google Instant Proxy Preview"); | 910 is_preview = ViaHeaderContains(frame, "1.1 Google Instant Proxy Preview"); |
898 } | 911 } |
899 | 912 |
900 MaybeDumpFirstLayoutHistograms(); | 913 MaybeDumpFirstLayoutHistograms(); |
901 | 914 |
902 // Metrics based on the timing information recorded for the Navigation Timing | 915 // Metrics based on the timing information recorded for the Navigation Timing |
903 // API - http://www.w3.org/TR/navigation-timing/. | 916 // API - http://www.w3.org/TR/navigation-timing/. |
904 DumpHistograms(frame->performance(), document_state, | 917 DumpHistograms(frame->performance(), document_state, |
905 data_reduction_proxy_was_used, lofi_status, | 918 data_reduction_proxy_was_used, lofi_used, came_from_websearch, |
906 came_from_websearch, websearch_chrome_joint_experiment_id, | 919 websearch_chrome_joint_experiment_id, is_preview, scheme_type); |
907 is_preview, scheme_type); | |
908 | 920 |
909 // Old metrics based on the timing information stored in DocumentState. These | 921 // Old metrics based on the timing information stored in DocumentState. These |
910 // are deprecated and should go away. | 922 // are deprecated and should go away. |
911 DumpDeprecatedHistograms(frame->performance(), document_state, | 923 DumpDeprecatedHistograms(frame->performance(), document_state, |
912 data_reduction_proxy_was_used, | 924 data_reduction_proxy_was_used, |
913 came_from_websearch, | 925 came_from_websearch, |
914 websearch_chrome_joint_experiment_id, | 926 websearch_chrome_joint_experiment_id, |
915 is_preview, | 927 is_preview, |
916 scheme_type); | 928 scheme_type); |
917 | 929 |
(...skipping 28 matching lines...) Expand all Loading... | |
946 first_layout - navigation_start); | 958 first_layout - navigation_start); |
947 | 959 |
948 Time response_start = Time::FromDoubleT(performance.responseStart()); | 960 Time response_start = Time::FromDoubleT(performance.responseStart()); |
949 if (!response_start.is_null()) | 961 if (!response_start.is_null()) |
950 PLT_HISTOGRAM("PLT.PT.ResponseStartToFirstLayout", | 962 PLT_HISTOGRAM("PLT.PT.ResponseStartToFirstLayout", |
951 first_layout - response_start); | 963 first_layout - response_start); |
952 | 964 |
953 dumped_first_layout_histograms_ = true; | 965 dumped_first_layout_histograms_ = true; |
954 } | 966 } |
955 | 967 |
956 void PageLoadHistograms::FrameWillClose(WebFrame* frame) { | 968 void PageLoadHistograms::FrameWillClose(WebFrame* frame, bool lofi_used) { |
957 Dump(frame); | 969 Dump(frame, lofi_used); |
958 } | 970 } |
959 | 971 |
960 void PageLoadHistograms::ClosePage() { | 972 void PageLoadHistograms::ClosePage(bool lofi_used) { |
961 // TODO(davemoore) This code should be removed once willClose() gets | 973 // TODO(davemoore) This code should be removed once willClose() gets |
962 // called when a page is destroyed. page_load_histograms_.Dump() is safe | 974 // called when a page is destroyed. page_load_histograms_.Dump() is safe |
963 // to call multiple times for the same frame, but it will simplify things. | 975 // to call multiple times for the same frame, but it will simplify things. |
964 Dump(render_view()->GetWebView()->mainFrame()); | 976 Dump(render_view()->GetWebView()->mainFrame(), lofi_used); |
965 } | 977 } |
966 | 978 |
967 void PageLoadHistograms::DidUpdateLayout() { | 979 void PageLoadHistograms::DidUpdateLayout() { |
968 DCHECK(content::RenderThread::Get()); | 980 DCHECK(content::RenderThread::Get()); |
969 // Normally, PageLoadHistograms dumps all histograms in the FrameWillClose or | 981 // Normally, PageLoadHistograms dumps all histograms in the FrameWillClose or |
970 // ClosePage callbacks, which happen as a page is being torn down. However, | 982 // ClosePage callbacks, which happen as a page is being torn down. However, |
971 // renderers that are killed by fast shutdown (for example, renderers closed | 983 // renderers that are killed by fast shutdown (for example, renderers closed |
972 // due to the user closing a tab) don't get a chance to run these callbacks | 984 // due to the user closing a tab) don't get a chance to run these callbacks |
973 // (see crbug.com/382542 for details). | 985 // (see crbug.com/382542 for details). |
974 // | 986 // |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1016 | 1028 |
1017 DCHECK(document_state); | 1029 DCHECK(document_state); |
1018 DCHECK(ds); | 1030 DCHECK(ds); |
1019 GURL url(ds->request().url()); | 1031 GURL url(ds->request().url()); |
1020 Time start = document_state->start_load_time(); | 1032 Time start = document_state->start_load_time(); |
1021 Time finish = document_state->finish_load_time(); | 1033 Time finish = document_state->finish_load_time(); |
1022 // TODO(mbelshe): should we log more stats? | 1034 // TODO(mbelshe): should we log more stats? |
1023 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " | 1035 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " |
1024 << url.spec(); | 1036 << url.spec(); |
1025 } | 1037 } |
OLD | NEW |