| 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 "content/renderer/render_thread_impl.h" | 5 #include "content/renderer/render_thread_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 | 191 |
| 192 class RenderViewZoomer : public RenderViewVisitor { | 192 class RenderViewZoomer : public RenderViewVisitor { |
| 193 public: | 193 public: |
| 194 RenderViewZoomer(const std::string& scheme, | 194 RenderViewZoomer(const std::string& scheme, |
| 195 const std::string& host, | 195 const std::string& host, |
| 196 double zoom_level) : scheme_(scheme), | 196 double zoom_level) : scheme_(scheme), |
| 197 host_(host), | 197 host_(host), |
| 198 zoom_level_(zoom_level) { | 198 zoom_level_(zoom_level) { |
| 199 } | 199 } |
| 200 | 200 |
| 201 virtual bool Visit(RenderView* render_view) override { | 201 bool Visit(RenderView* render_view) override { |
| 202 WebView* webview = render_view->GetWebView(); | 202 WebView* webview = render_view->GetWebView(); |
| 203 WebDocument document = webview->mainFrame()->document(); | 203 WebDocument document = webview->mainFrame()->document(); |
| 204 | 204 |
| 205 // Don't set zoom level for full-page plugin since they don't use the same | 205 // Don't set zoom level for full-page plugin since they don't use the same |
| 206 // zoom settings. | 206 // zoom settings. |
| 207 if (document.isPluginDocument()) | 207 if (document.isPluginDocument()) |
| 208 return true; | 208 return true; |
| 209 GURL url(document.url()); | 209 GURL url(document.url()); |
| 210 // Empty scheme works as wildcard that matches any scheme, | 210 // Empty scheme works as wildcard that matches any scheme, |
| 211 if ((net::GetHostOrSpecFromURL(url) == host_) && | 211 if ((net::GetHostOrSpecFromURL(url) == host_) && |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 return; | 277 return; |
| 278 v8::Date::DateTimeConfigurationChangeNotification(isolate); | 278 v8::Date::DateTimeConfigurationChangeNotification(isolate); |
| 279 } | 279 } |
| 280 | 280 |
| 281 class RenderFrameSetupImpl : public mojo::InterfaceImpl<RenderFrameSetup> { | 281 class RenderFrameSetupImpl : public mojo::InterfaceImpl<RenderFrameSetup> { |
| 282 public: | 282 public: |
| 283 RenderFrameSetupImpl() | 283 RenderFrameSetupImpl() |
| 284 : routing_id_highmark_(-1) { | 284 : routing_id_highmark_(-1) { |
| 285 } | 285 } |
| 286 | 286 |
| 287 virtual void GetServiceProviderForFrame( | 287 void GetServiceProviderForFrame( |
| 288 int32_t frame_routing_id, | 288 int32_t frame_routing_id, |
| 289 mojo::InterfaceRequest<mojo::ServiceProvider> request) override { | 289 mojo::InterfaceRequest<mojo::ServiceProvider> request) override { |
| 290 // TODO(morrita): This is for investigating http://crbug.com/415059 and | 290 // TODO(morrita): This is for investigating http://crbug.com/415059 and |
| 291 // should be removed once it is fixed. | 291 // should be removed once it is fixed. |
| 292 CHECK_LT(routing_id_highmark_, frame_routing_id); | 292 CHECK_LT(routing_id_highmark_, frame_routing_id); |
| 293 routing_id_highmark_ = frame_routing_id; | 293 routing_id_highmark_ = frame_routing_id; |
| 294 | 294 |
| 295 RenderFrameImpl* frame = RenderFrameImpl::FromRoutingID(frame_routing_id); | 295 RenderFrameImpl* frame = RenderFrameImpl::FromRoutingID(frame_routing_id); |
| 296 // We can receive a GetServiceProviderForFrame message for a frame not yet | 296 // We can receive a GetServiceProviderForFrame message for a frame not yet |
| 297 // created due to a race between the message and a ViewMsg_New IPC that | 297 // created due to a race between the message and a ViewMsg_New IPC that |
| (...skipping 30 matching lines...) Expand all Loading... |
| 328 attributes.noAutomaticFlushes = true; | 328 attributes.noAutomaticFlushes = true; |
| 329 return attributes; | 329 return attributes; |
| 330 } | 330 } |
| 331 | 331 |
| 332 } // namespace | 332 } // namespace |
| 333 | 333 |
| 334 // For measuring memory usage after each task. Behind a command line flag. | 334 // For measuring memory usage after each task. Behind a command line flag. |
| 335 class MemoryObserver : public base::MessageLoop::TaskObserver { | 335 class MemoryObserver : public base::MessageLoop::TaskObserver { |
| 336 public: | 336 public: |
| 337 MemoryObserver() {} | 337 MemoryObserver() {} |
| 338 virtual ~MemoryObserver() {} | 338 ~MemoryObserver() override {} |
| 339 | 339 |
| 340 virtual void WillProcessTask(const base::PendingTask& pending_task) override { | 340 void WillProcessTask(const base::PendingTask& pending_task) override {} |
| 341 } | |
| 342 | 341 |
| 343 virtual void DidProcessTask(const base::PendingTask& pending_task) override { | 342 void DidProcessTask(const base::PendingTask& pending_task) override { |
| 344 LOCAL_HISTOGRAM_MEMORY_KB("Memory.RendererUsed", GetMemoryUsageKB()); | 343 LOCAL_HISTOGRAM_MEMORY_KB("Memory.RendererUsed", GetMemoryUsageKB()); |
| 345 } | 344 } |
| 346 | 345 |
| 347 private: | 346 private: |
| 348 DISALLOW_COPY_AND_ASSIGN(MemoryObserver); | 347 DISALLOW_COPY_AND_ASSIGN(MemoryObserver); |
| 349 }; | 348 }; |
| 350 | 349 |
| 351 RenderThreadImpl::HistogramCustomizer::HistogramCustomizer() { | 350 RenderThreadImpl::HistogramCustomizer::HistogramCustomizer() { |
| 352 custom_histograms_.insert("V8.MemoryExternalFragmentationTotal"); | 351 custom_histograms_.insert("V8.MemoryExternalFragmentationTotal"); |
| 353 custom_histograms_.insert("V8.MemoryHeapSampleTotalCommitted"); | 352 custom_histograms_.insert("V8.MemoryHeapSampleTotalCommitted"); |
| (...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1582 hidden_widget_count_--; | 1581 hidden_widget_count_--; |
| 1583 | 1582 |
| 1584 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { | 1583 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { |
| 1585 return; | 1584 return; |
| 1586 } | 1585 } |
| 1587 | 1586 |
| 1588 ScheduleIdleHandler(kLongIdleHandlerDelayMs); | 1587 ScheduleIdleHandler(kLongIdleHandlerDelayMs); |
| 1589 } | 1588 } |
| 1590 | 1589 |
| 1591 } // namespace content | 1590 } // namespace content |
| OLD | NEW |