Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/chrome_render_frame_observer.h" | 5 #include "chrome/renderer/chrome_render_frame_observer.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include <limits> | 10 #include <limits> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/metrics/histogram_macros.h" | 15 #include "base/metrics/histogram_macros.h" |
| 16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
| 17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 18 #include "build/build_config.h" | 18 #include "build/build_config.h" |
| 19 #include "chrome/common/chrome_isolated_world_ids.h" | 19 #include "chrome/common/chrome_isolated_world_ids.h" |
| 20 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
| 21 #include "chrome/common/crash_keys.h" | 21 #include "chrome/common/crash_keys.h" |
| 22 #include "chrome/common/prerender_messages.h" | 22 #include "chrome/common/prerender_messages.h" |
| 23 #include "chrome/common/render_messages.h" | 23 #include "chrome/common/render_messages.h" |
| 24 #include "chrome/renderer/prerender/prerender_helper.h" | 24 #include "chrome/renderer/prerender/prerender_helper.h" |
| 25 #include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h" | 25 #include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h" |
| 26 #include "components/translate/content/renderer/translate_helper.h" | 26 #include "components/translate/content/renderer/translate_helper.h" |
| 27 #include "content/public/renderer/render_frame.h" | 27 #include "content/public/renderer/render_frame.h" |
| 28 #include "content/public/renderer/render_thread.h" | |
| 28 #include "content/public/renderer/render_view.h" | 29 #include "content/public/renderer/render_view.h" |
| 29 #include "extensions/common/constants.h" | 30 #include "extensions/common/constants.h" |
| 30 #include "printing/features/features.h" | 31 #include "printing/features/features.h" |
| 31 #include "skia/ext/image_operations.h" | 32 #include "skia/ext/image_operations.h" |
| 32 #include "third_party/WebKit/public/platform/WebImage.h" | 33 #include "third_party/WebKit/public/platform/WebImage.h" |
| 33 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 34 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
| 34 #include "third_party/WebKit/public/web/WebDataSource.h" | 35 #include "third_party/WebKit/public/web/WebDataSource.h" |
| 35 #include "third_party/WebKit/public/web/WebDocument.h" | 36 #include "third_party/WebKit/public/web/WebDocument.h" |
| 36 #include "third_party/WebKit/public/web/WebElement.h" | 37 #include "third_party/WebKit/public/web/WebElement.h" |
| 37 #include "third_party/WebKit/public/web/WebFrameContentDumper.h" | 38 #include "third_party/WebKit/public/web/WebFrameContentDumper.h" |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 242 WebLocalFrame* frame = render_frame()->GetWebFrame(); | 243 WebLocalFrame* frame = render_frame()->GetWebFrame(); |
| 243 // Don't do anything for subframes. | 244 // Don't do anything for subframes. |
| 244 if (frame->parent()) | 245 if (frame->parent()) |
| 245 return; | 246 return; |
| 246 | 247 |
| 247 GURL osdd_url = frame->document().openSearchDescriptionURL(); | 248 GURL osdd_url = frame->document().openSearchDescriptionURL(); |
| 248 if (!osdd_url.is_empty()) { | 249 if (!osdd_url.is_empty()) { |
| 249 Send(new ChromeViewHostMsg_PageHasOSDD( | 250 Send(new ChromeViewHostMsg_PageHasOSDD( |
| 250 routing_id(), frame->document().url(), osdd_url)); | 251 routing_id(), frame->document().url(), osdd_url)); |
| 251 } | 252 } |
| 253 | |
| 254 content::RendererMemoryMetrics memory_metrics; | |
| 255 content::RenderThread::Get()->GetRendererMemoryMetrics(&memory_metrics); | |
|
haraken
2016/12/12 11:32:27
Can we measure # of tabs in this renderer at this
keishi
2017/01/06 11:08:27
Added Memory.Experimental.Renderer.*.TotalAllocate
| |
| 256 UMA_HISTOGRAM_MEMORY_KB("Renderer.Memory.DidFinishLoad.PartitionAllocKB", | |
| 257 memory_metrics.partition_alloc_kb); | |
| 258 UMA_HISTOGRAM_MEMORY_KB("Renderer.Memory.DidFinishLoad.BlinkGCKB", | |
| 259 memory_metrics.blink_gc_kb); | |
| 260 UMA_HISTOGRAM_MEMORY_MB("Renderer.Memory.DidFinishLoad.MallocMB", | |
| 261 memory_metrics.malloc_mb); | |
| 262 UMA_HISTOGRAM_MEMORY_KB("Renderer.Memory.DidFinishLoad.DiscardableKB", | |
| 263 memory_metrics.discardable_kb); | |
| 264 UMA_HISTOGRAM_MEMORY_MB("Renderer.Memory.DidFinishLoad.V8MainThreadIsolateMB", | |
| 265 memory_metrics.v8_main_thread_isolate_mb); | |
| 266 UMA_HISTOGRAM_MEMORY_MB("Renderer.Memory.DidFinishLoad.TotalAllocatedMB", | |
| 267 memory_metrics.total_allocated_mb); | |
| 268 UMA_HISTOGRAM_MEMORY_MB( | |
| 269 "Renderer.Memory.DidFinishLoad.NonDiscardableTotalAllocatedMB", | |
| 270 memory_metrics.non_discardable_total_allocated_mb); | |
| 252 } | 271 } |
| 253 | 272 |
| 254 void ChromeRenderFrameObserver::DidStartProvisionalLoad() { | 273 void ChromeRenderFrameObserver::DidStartProvisionalLoad() { |
| 255 // Let translate_helper do any preparatory work for loading a URL. | 274 // Let translate_helper do any preparatory work for loading a URL. |
| 256 if (!translate_helper_) | 275 if (!translate_helper_) |
| 257 return; | 276 return; |
| 258 | 277 |
| 259 translate_helper_->PrepareForUrl( | 278 translate_helper_->PrepareForUrl( |
| 260 render_frame()->GetWebFrame()->document().url()); | 279 render_frame()->GetWebFrame()->document().url()); |
| 261 } | 280 } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 338 CapturePageText(FINAL_CAPTURE); | 357 CapturePageText(FINAL_CAPTURE); |
| 339 break; | 358 break; |
| 340 default: | 359 default: |
| 341 break; | 360 break; |
| 342 } | 361 } |
| 343 } | 362 } |
| 344 | 363 |
| 345 void ChromeRenderFrameObserver::OnDestruct() { | 364 void ChromeRenderFrameObserver::OnDestruct() { |
| 346 delete this; | 365 delete this; |
| 347 } | 366 } |
| OLD | NEW |