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 virtual 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 virtual 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 |
298 // triggers creation of the RenderFrame we want. | 298 // triggers creation of the RenderFrame we want. |
299 if (!frame) { | 299 if (!frame) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 } | 336 } |
337 | 337 |
338 } // namespace | 338 } // namespace |
339 | 339 |
340 // For measuring memory usage after each task. Behind a command line flag. | 340 // For measuring memory usage after each task. Behind a command line flag. |
341 class MemoryObserver : public base::MessageLoop::TaskObserver { | 341 class MemoryObserver : public base::MessageLoop::TaskObserver { |
342 public: | 342 public: |
343 MemoryObserver() {} | 343 MemoryObserver() {} |
344 virtual ~MemoryObserver() {} | 344 virtual ~MemoryObserver() {} |
345 | 345 |
346 virtual void WillProcessTask(const base::PendingTask& pending_task) OVERRIDE { | 346 virtual void WillProcessTask(const base::PendingTask& pending_task) override { |
347 } | 347 } |
348 | 348 |
349 virtual void DidProcessTask(const base::PendingTask& pending_task) OVERRIDE { | 349 virtual void DidProcessTask(const base::PendingTask& pending_task) override { |
350 LOCAL_HISTOGRAM_MEMORY_KB("Memory.RendererUsed", GetMemoryUsageKB()); | 350 LOCAL_HISTOGRAM_MEMORY_KB("Memory.RendererUsed", GetMemoryUsageKB()); |
351 } | 351 } |
352 | 352 |
353 private: | 353 private: |
354 DISALLOW_COPY_AND_ASSIGN(MemoryObserver); | 354 DISALLOW_COPY_AND_ASSIGN(MemoryObserver); |
355 }; | 355 }; |
356 | 356 |
357 RenderThreadImpl::HistogramCustomizer::HistogramCustomizer() { | 357 RenderThreadImpl::HistogramCustomizer::HistogramCustomizer() { |
358 custom_histograms_.insert("V8.MemoryExternalFragmentationTotal"); | 358 custom_histograms_.insert("V8.MemoryExternalFragmentationTotal"); |
359 custom_histograms_.insert("V8.MemoryHeapSampleTotalCommitted"); | 359 custom_histograms_.insert("V8.MemoryHeapSampleTotalCommitted"); |
(...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1632 hidden_widget_count_--; | 1632 hidden_widget_count_--; |
1633 | 1633 |
1634 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { | 1634 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { |
1635 return; | 1635 return; |
1636 } | 1636 } |
1637 | 1637 |
1638 ScheduleIdleHandler(kLongIdleHandlerDelayMs); | 1638 ScheduleIdleHandler(kLongIdleHandlerDelayMs); |
1639 } | 1639 } |
1640 | 1640 |
1641 } // namespace content | 1641 } // namespace content |
OLD | NEW |