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/chrome_render_process_observer.h" | 5 #include "chrome/renderer/chrome_render_process_observer.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/allocator/allocator_extension.h" | 10 #include "base/allocator/allocator_extension.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 const size_t kUnitializedCacheCapacity = UINT_MAX; | 60 const size_t kUnitializedCacheCapacity = UINT_MAX; |
61 | 61 |
62 class RendererResourceDelegate : public content::ResourceDispatcherDelegate { | 62 class RendererResourceDelegate : public content::ResourceDispatcherDelegate { |
63 public: | 63 public: |
64 RendererResourceDelegate() | 64 RendererResourceDelegate() |
65 : weak_factory_(this) { | 65 : weak_factory_(this) { |
66 } | 66 } |
67 | 67 |
68 virtual content::RequestPeer* OnRequestComplete( | 68 virtual content::RequestPeer* OnRequestComplete( |
69 content::RequestPeer* current_peer, | 69 content::RequestPeer* current_peer, |
70 content::ResourceType::Type resource_type, | 70 content::ResourceType resource_type, |
71 int error_code) OVERRIDE { | 71 int error_code) OVERRIDE { |
72 // Update the browser about our cache. | 72 // Update the browser about our cache. |
73 // Rate limit informing the host of our cache stats. | 73 // Rate limit informing the host of our cache stats. |
74 if (!weak_factory_.HasWeakPtrs()) { | 74 if (!weak_factory_.HasWeakPtrs()) { |
75 base::MessageLoop::current()->PostDelayedTask( | 75 base::MessageLoop::current()->PostDelayedTask( |
76 FROM_HERE, | 76 FROM_HERE, |
77 base::Bind(&RendererResourceDelegate::InformHostOfCacheStats, | 77 base::Bind(&RendererResourceDelegate::InformHostOfCacheStats, |
78 weak_factory_.GetWeakPtr()), | 78 weak_factory_.GetWeakPtr()), |
79 base::TimeDelta::FromMilliseconds(kCacheStatsDelayMS)); | 79 base::TimeDelta::FromMilliseconds(kCacheStatsDelayMS)); |
80 } | 80 } |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 if (clear_cache_pending_ && webkit_initialized_) { | 407 if (clear_cache_pending_ && webkit_initialized_) { |
408 clear_cache_pending_ = false; | 408 clear_cache_pending_ = false; |
409 WebCache::clear(); | 409 WebCache::clear(); |
410 } | 410 } |
411 } | 411 } |
412 | 412 |
413 const RendererContentSettingRules* | 413 const RendererContentSettingRules* |
414 ChromeRenderProcessObserver::content_setting_rules() const { | 414 ChromeRenderProcessObserver::content_setting_rules() const { |
415 return &content_setting_rules_; | 415 return &content_setting_rules_; |
416 } | 416 } |
OLD | NEW |