Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: chrome/renderer/chrome_render_process_observer.cc

Issue 218973002: Extract Peer interface out of ResourceLoaderBridge. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: REBASED Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/renderer/extensions/extension_localization_peer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 const int kCacheStatsDelayMS = 2000; 59 const int kCacheStatsDelayMS = 2000;
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 webkit_glue::ResourceLoaderBridge::Peer* OnRequestComplete( 68 virtual content::RequestPeer* OnRequestComplete(
69 webkit_glue::ResourceLoaderBridge::Peer* current_peer, 69 content::RequestPeer* current_peer,
70 ResourceType::Type resource_type, 70 ResourceType::Type 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 }
81 81
82 if (error_code == net::ERR_ABORTED) { 82 if (error_code == net::ERR_ABORTED) {
83 return NULL; 83 return NULL;
84 } 84 }
85 85
86 // Resource canceled with a specific error are filtered. 86 // Resource canceled with a specific error are filtered.
87 return SecurityFilterPeer::CreateSecurityFilterPeerForDeniedRequest( 87 return SecurityFilterPeer::CreateSecurityFilterPeerForDeniedRequest(
88 resource_type, current_peer, error_code); 88 resource_type, current_peer, error_code);
89 } 89 }
90 90
91 virtual webkit_glue::ResourceLoaderBridge::Peer* OnReceivedResponse( 91 virtual content::RequestPeer* OnReceivedResponse(
92 webkit_glue::ResourceLoaderBridge::Peer* current_peer, 92 content::RequestPeer* current_peer,
93 const std::string& mime_type, 93 const std::string& mime_type,
94 const GURL& url) OVERRIDE { 94 const GURL& url) OVERRIDE {
95 return ExtensionLocalizationPeer::CreateExtensionLocalizationPeer( 95 return ExtensionLocalizationPeer::CreateExtensionLocalizationPeer(
96 current_peer, RenderThread::Get(), mime_type, url); 96 current_peer, RenderThread::Get(), mime_type, url);
97 } 97 }
98 98
99 private: 99 private:
100 void InformHostOfCacheStats() { 100 void InformHostOfCacheStats() {
101 WebCache::UsageStats stats; 101 WebCache::UsageStats stats;
102 WebCache::getUsageStats(&stats); 102 WebCache::getUsageStats(&stats);
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 if (clear_cache_pending_ && webkit_initialized_) { 406 if (clear_cache_pending_ && webkit_initialized_) {
407 clear_cache_pending_ = false; 407 clear_cache_pending_ = false;
408 WebCache::clear(); 408 WebCache::clear();
409 } 409 }
410 } 410 }
411 411
412 const RendererContentSettingRules* 412 const RendererContentSettingRules*
413 ChromeRenderProcessObserver::content_setting_rules() const { 413 ChromeRenderProcessObserver::content_setting_rules() const {
414 return &content_setting_rules_; 414 return &content_setting_rules_;
415 } 415 }
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/extensions/extension_localization_peer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698