OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/render_view.h" | 5 #include "chrome/renderer/render_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1633 // The feed discovery code would also benefit from access to the head. | 1633 // The feed discovery code would also benefit from access to the head. |
1634 GURL favicon_url(webview()->mainFrame()->favIconURL()); | 1634 GURL favicon_url(webview()->mainFrame()->favIconURL()); |
1635 if (!favicon_url.is_empty()) | 1635 if (!favicon_url.is_empty()) |
1636 Send(new ViewHostMsg_UpdateFavIconURL(routing_id_, page_id_, favicon_url)); | 1636 Send(new ViewHostMsg_UpdateFavIconURL(routing_id_, page_id_, favicon_url)); |
1637 | 1637 |
1638 AddGURLSearchProvider(webview()->mainFrame()->openSearchDescriptionURL(), | 1638 AddGURLSearchProvider(webview()->mainFrame()->openSearchDescriptionURL(), |
1639 true); // autodetected | 1639 true); // autodetected |
1640 | 1640 |
1641 Send(new ViewHostMsg_DidStopLoading(routing_id_)); | 1641 Send(new ViewHostMsg_DidStopLoading(routing_id_)); |
1642 | 1642 |
1643 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 1643 MessageLoop::current()->PostDelayedTask( |
| 1644 FROM_HERE, |
1644 method_factory_.NewRunnableMethod(&RenderView::CapturePageInfo, page_id_, | 1645 method_factory_.NewRunnableMethod(&RenderView::CapturePageInfo, page_id_, |
1645 false), | 1646 false), |
1646 kDelayForCaptureMs); | 1647 kDelayForCaptureMs); |
1647 } | 1648 } |
1648 | 1649 |
1649 bool RenderView::isSmartInsertDeleteEnabled() { | 1650 bool RenderView::isSmartInsertDeleteEnabled() { |
1650 #if defined(OS_MACOSX) | 1651 #if defined(OS_MACOSX) |
1651 return true; | 1652 return true; |
1652 #else | 1653 #else |
1653 return false; | 1654 return false; |
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2554 // We bump our Page ID to correspond with the new session history entry. | 2555 // We bump our Page ID to correspond with the new session history entry. |
2555 page_id_ = next_page_id_++; | 2556 page_id_ = next_page_id_++; |
2556 | 2557 |
2557 // Advance our offset in session history, applying the length limit. There | 2558 // Advance our offset in session history, applying the length limit. There |
2558 // is now no forward history. | 2559 // is now no forward history. |
2559 history_list_offset_++; | 2560 history_list_offset_++; |
2560 if (history_list_offset_ >= chrome::kMaxSessionHistoryEntries) | 2561 if (history_list_offset_ >= chrome::kMaxSessionHistoryEntries) |
2561 history_list_offset_ = chrome::kMaxSessionHistoryEntries - 1; | 2562 history_list_offset_ = chrome::kMaxSessionHistoryEntries - 1; |
2562 history_list_length_ = history_list_offset_ + 1; | 2563 history_list_length_ = history_list_offset_ + 1; |
2563 | 2564 |
2564 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 2565 MessageLoop::current()->PostDelayedTask( |
| 2566 FROM_HERE, |
2565 method_factory_.NewRunnableMethod(&RenderView::CapturePageInfo, | 2567 method_factory_.NewRunnableMethod(&RenderView::CapturePageInfo, |
2566 page_id_, true), | 2568 page_id_, true), |
2567 kDelayForForcedCaptureMs); | 2569 kDelayForForcedCaptureMs); |
2568 } else { | 2570 } else { |
2569 // Inspect the navigation_state on this frame to see if the navigation | 2571 // Inspect the navigation_state on this frame to see if the navigation |
2570 // corresponds to a session history navigation... Note: |frame| may or | 2572 // corresponds to a session history navigation... Note: |frame| may or |
2571 // may not be the toplevel frame, but for the case of capturing session | 2573 // may not be the toplevel frame, but for the case of capturing session |
2572 // history, the first committed frame suffices. We keep track of whether | 2574 // history, the first committed frame suffices. We keep track of whether |
2573 // we've seen this commit before so that only capture session history once | 2575 // we've seen this commit before so that only capture session history once |
2574 // per navigation. | 2576 // per navigation. |
(...skipping 1564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4139 // It's possible for the request time not to be set, if a client | 4141 // It's possible for the request time not to be set, if a client |
4140 // redirect had been done (the user never requested the page) | 4142 // redirect had been done (the user never requested the page) |
4141 // Also, it's possible to load a page without ever laying it out | 4143 // Also, it's possible to load a page without ever laying it out |
4142 // so first_paint and first_paint_after_load can be 0. | 4144 // so first_paint and first_paint_after_load can be 0. |
4143 void RenderView::DumpLoadHistograms() const { | 4145 void RenderView::DumpLoadHistograms() const { |
4144 WebFrame* main_frame = webview()->mainFrame(); | 4146 WebFrame* main_frame = webview()->mainFrame(); |
4145 NavigationState* navigation_state = | 4147 NavigationState* navigation_state = |
4146 NavigationState::FromDataSource(main_frame->dataSource()); | 4148 NavigationState::FromDataSource(main_frame->dataSource()); |
4147 Time finish = navigation_state->finish_load_time(); | 4149 Time finish = navigation_state->finish_load_time(); |
4148 | 4150 |
4149 // If we've already dumped or we haven't finished loading, do nothing. | 4151 // If we've already dumped, do nothing. |
4150 if (navigation_state->load_histograms_recorded() || finish.is_null()) | 4152 if (navigation_state->load_histograms_recorded()) |
4151 return; | 4153 return; |
4152 | 4154 |
| 4155 // Handle case where user hits "stop" or "back" before loading completely. |
| 4156 bool abandoned_page = finish.is_null(); |
| 4157 if (abandoned_page) { |
| 4158 finish = Time::Now(); |
| 4159 navigation_state->set_finish_load_time(finish); |
| 4160 } |
| 4161 UMA_HISTOGRAM_ENUMERATION("Renderer4.Abandoned", abandoned_page ? 1 : 0, 2); |
| 4162 |
4153 LogNavigationState(navigation_state, main_frame->dataSource()); | 4163 LogNavigationState(navigation_state, main_frame->dataSource()); |
4154 | 4164 |
4155 NavigationState::LoadType load_type = navigation_state->load_type(); | 4165 NavigationState::LoadType load_type = navigation_state->load_type(); |
4156 UMA_HISTOGRAM_ENUMERATION("Renderer4.LoadType", load_type, | 4166 UMA_HISTOGRAM_ENUMERATION("Renderer4.LoadType", load_type, |
4157 NavigationState::kLoadTypeMax); | 4167 NavigationState::kLoadTypeMax); |
4158 | 4168 |
4159 // Site isolation metrics. | 4169 // Site isolation metrics. |
4160 UMA_HISTOGRAM_COUNTS("SiteIsolation.PageLoadsWithCrossSiteFrameAccess", | 4170 UMA_HISTOGRAM_COUNTS("SiteIsolation.PageLoadsWithCrossSiteFrameAccess", |
4161 cross_origin_access_count_); | 4171 cross_origin_access_count_); |
4162 UMA_HISTOGRAM_COUNTS("SiteIsolation.PageLoadsWithSameSiteFrameAccess", | 4172 UMA_HISTOGRAM_COUNTS("SiteIsolation.PageLoadsWithSameSiteFrameAccess", |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4264 begin_to_finish, kBeginToFinishMin, kBeginToFinishMax, | 4274 begin_to_finish, kBeginToFinishMin, kBeginToFinishMax, |
4265 kBeginToFinishBucketCount); | 4275 kBeginToFinishBucketCount); |
4266 break; | 4276 break; |
4267 default: | 4277 default: |
4268 break; | 4278 break; |
4269 } | 4279 } |
4270 | 4280 |
4271 static bool use_dns_histogram(FieldTrialList::Find("DnsImpact") && | 4281 static bool use_dns_histogram(FieldTrialList::Find("DnsImpact") && |
4272 !FieldTrialList::Find("DnsImpact")->group_name().empty()); | 4282 !FieldTrialList::Find("DnsImpact")->group_name().empty()); |
4273 if (use_dns_histogram) { | 4283 if (use_dns_histogram) { |
4274 UMA_HISTOGRAM_ENUMERATION(FieldTrial::MakeName( | 4284 UMA_HISTOGRAM_ENUMERATION( |
4275 "Renderer4.LoadType", "DnsImpact"), | 4285 FieldTrial::MakeName("Renderer4.Abandoned", "DnsImpact"), |
| 4286 abandoned_page ? 1 : 0, 2); |
| 4287 UMA_HISTOGRAM_ENUMERATION( |
| 4288 FieldTrial::MakeName("Renderer4.LoadType", "DnsImpact"), |
4276 load_type, NavigationState::kLoadTypeMax); | 4289 load_type, NavigationState::kLoadTypeMax); |
4277 switch (load_type) { | 4290 switch (load_type) { |
4278 case NavigationState::NORMAL_LOAD: | 4291 case NavigationState::NORMAL_LOAD: |
4279 UMA_HISTOGRAM_CUSTOM_TIMES(FieldTrial::MakeName( | 4292 UMA_HISTOGRAM_CUSTOM_TIMES(FieldTrial::MakeName( |
4280 "Renderer4.BeginToFinish_NormalLoad", "DnsImpact"), | 4293 "Renderer4.BeginToFinish_NormalLoad", "DnsImpact"), |
4281 begin_to_finish, kBeginToFinishMin, kBeginToFinishMax, | 4294 begin_to_finish, kBeginToFinishMin, kBeginToFinishMax, |
4282 kBeginToFinishBucketCount); | 4295 kBeginToFinishBucketCount); |
4283 break; | 4296 break; |
4284 case NavigationState::LINK_LOAD_NORMAL: | 4297 case NavigationState::LINK_LOAD_NORMAL: |
4285 UMA_HISTOGRAM_CUSTOM_TIMES(FieldTrial::MakeName( | 4298 UMA_HISTOGRAM_CUSTOM_TIMES(FieldTrial::MakeName( |
(...skipping 11 matching lines...) Expand all Loading... |
4297 UMA_HISTOGRAM_CUSTOM_TIMES(FieldTrial::MakeName( | 4310 UMA_HISTOGRAM_CUSTOM_TIMES(FieldTrial::MakeName( |
4298 "Renderer4.BeginToFinish_LinkLoadStaleOk", "DnsImpact"), | 4311 "Renderer4.BeginToFinish_LinkLoadStaleOk", "DnsImpact"), |
4299 begin_to_finish, kBeginToFinishMin, kBeginToFinishMax, | 4312 begin_to_finish, kBeginToFinishMin, kBeginToFinishMax, |
4300 kBeginToFinishBucketCount); | 4313 kBeginToFinishBucketCount); |
4301 break; | 4314 break; |
4302 default: | 4315 default: |
4303 break; | 4316 break; |
4304 } | 4317 } |
4305 } | 4318 } |
4306 | 4319 |
| 4320 static bool use_packet_split_histogram(FieldTrialList::Find("PacketSplit") && |
| 4321 !FieldTrialList::Find("PacketSplit")->group_name().empty()); |
| 4322 if (use_packet_split_histogram) { |
| 4323 UMA_HISTOGRAM_ENUMERATION( |
| 4324 FieldTrial::MakeName("Renderer4.Abandoned", "PacketSplit"), |
| 4325 abandoned_page ? 1 : 0, 2); |
| 4326 UMA_HISTOGRAM_ENUMERATION( |
| 4327 FieldTrial::MakeName("Renderer4.LoadType", "PacketSplit"), |
| 4328 load_type, NavigationState::kLoadTypeMax); |
| 4329 switch (load_type) { |
| 4330 case NavigationState::NORMAL_LOAD: |
| 4331 UMA_HISTOGRAM_CUSTOM_TIMES(FieldTrial::MakeName( |
| 4332 "Renderer4.BeginToFinish_NormalLoad", "PacketSplit"), |
| 4333 begin_to_finish, kBeginToFinishMin, kBeginToFinishMax, |
| 4334 kBeginToFinishBucketCount); |
| 4335 break; |
| 4336 case NavigationState::LINK_LOAD_NORMAL: |
| 4337 UMA_HISTOGRAM_CUSTOM_TIMES(FieldTrial::MakeName( |
| 4338 "Renderer4.BeginToFinish_LinkLoadNormal", "PacketSplit"), |
| 4339 begin_to_finish, kBeginToFinishMin, kBeginToFinishMax, |
| 4340 kBeginToFinishBucketCount); |
| 4341 break; |
| 4342 case NavigationState::LINK_LOAD_RELOAD: |
| 4343 UMA_HISTOGRAM_CUSTOM_TIMES(FieldTrial::MakeName( |
| 4344 "Renderer4.BeginToFinish_LinkLoadReload", "PacketSplit"), |
| 4345 begin_to_finish, kBeginToFinishMin, kBeginToFinishMax, |
| 4346 kBeginToFinishBucketCount); |
| 4347 break; |
| 4348 case NavigationState::LINK_LOAD_CACHE_STALE_OK: |
| 4349 UMA_HISTOGRAM_CUSTOM_TIMES(FieldTrial::MakeName( |
| 4350 "Renderer4.BeginToFinish_LinkLoadStaleOk", "PacketSplit"), |
| 4351 begin_to_finish, kBeginToFinishMin, kBeginToFinishMax, |
| 4352 kBeginToFinishBucketCount); |
| 4353 break; |
| 4354 default: |
| 4355 break; |
| 4356 } |
| 4357 } |
| 4358 |
4307 static bool use_sdch_histogram(FieldTrialList::Find("GlobalSdch") && | 4359 static bool use_sdch_histogram(FieldTrialList::Find("GlobalSdch") && |
4308 !FieldTrialList::Find("GlobalSdch")->group_name().empty()); | 4360 !FieldTrialList::Find("GlobalSdch")->group_name().empty()); |
4309 if (use_sdch_histogram) { | 4361 if (use_sdch_histogram) { |
4310 UMA_HISTOGRAM_ENUMERATION( | 4362 UMA_HISTOGRAM_ENUMERATION( |
4311 FieldTrial::MakeName("Renderer4.LoadType", "GlobalSdch"), | 4363 FieldTrial::MakeName("Renderer4.LoadType", "GlobalSdch"), |
4312 load_type, NavigationState::kLoadTypeMax); | 4364 load_type, NavigationState::kLoadTypeMax); |
4313 switch (load_type) { | 4365 switch (load_type) { |
4314 case NavigationState::NORMAL_LOAD: | 4366 case NavigationState::NORMAL_LOAD: |
4315 UMA_HISTOGRAM_CUSTOM_TIMES(FieldTrial::MakeName( | 4367 UMA_HISTOGRAM_CUSTOM_TIMES(FieldTrial::MakeName( |
4316 "Renderer4.BeginToFinish_NormalLoad", "GlobalSdch"), | 4368 "Renderer4.BeginToFinish_NormalLoad", "GlobalSdch"), |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4685 gfx::PluginWindowHandle window) { | 4737 gfx::PluginWindowHandle window) { |
4686 Send(new ViewHostMsg_AcceleratedSurfaceBuffersSwapped(routing_id(), window)); | 4738 Send(new ViewHostMsg_AcceleratedSurfaceBuffersSwapped(routing_id(), window)); |
4687 } | 4739 } |
4688 #endif | 4740 #endif |
4689 | 4741 |
4690 WebKit::WebGeolocationServiceInterface* RenderView::getGeolocationService() { | 4742 WebKit::WebGeolocationServiceInterface* RenderView::getGeolocationService() { |
4691 if (!geolocation_dispatcher_.get()) | 4743 if (!geolocation_dispatcher_.get()) |
4692 geolocation_dispatcher_.reset(new GeolocationDispatcher(this)); | 4744 geolocation_dispatcher_.reset(new GeolocationDispatcher(this)); |
4693 return geolocation_dispatcher_.get(); | 4745 return geolocation_dispatcher_.get(); |
4694 } | 4746 } |
OLD | NEW |