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

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

Issue 186193005: Move resource_loader_bridge to content/public/child/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 const int kCacheStatsDelayMS = 2000; 66 const int kCacheStatsDelayMS = 2000;
67 const size_t kUnitializedCacheCapacity = UINT_MAX; 67 const size_t kUnitializedCacheCapacity = UINT_MAX;
68 68
69 class RendererResourceDelegate : public content::ResourceDispatcherDelegate { 69 class RendererResourceDelegate : public content::ResourceDispatcherDelegate {
70 public: 70 public:
71 RendererResourceDelegate() 71 RendererResourceDelegate()
72 : weak_factory_(this) { 72 : weak_factory_(this) {
73 } 73 }
74 74
75 virtual webkit_glue::ResourceLoaderBridge::Peer* OnRequestComplete( 75 virtual content::ResourceLoaderBridge::Peer* OnRequestComplete(
76 webkit_glue::ResourceLoaderBridge::Peer* current_peer, 76 content::ResourceLoaderBridge::Peer* current_peer,
77 ResourceType::Type resource_type, 77 ResourceType::Type resource_type,
78 int error_code) OVERRIDE { 78 int error_code) OVERRIDE {
79 // Update the browser about our cache. 79 // Update the browser about our cache.
80 // Rate limit informing the host of our cache stats. 80 // Rate limit informing the host of our cache stats.
81 if (!weak_factory_.HasWeakPtrs()) { 81 if (!weak_factory_.HasWeakPtrs()) {
82 base::MessageLoop::current()->PostDelayedTask( 82 base::MessageLoop::current()->PostDelayedTask(
83 FROM_HERE, 83 FROM_HERE,
84 base::Bind(&RendererResourceDelegate::InformHostOfCacheStats, 84 base::Bind(&RendererResourceDelegate::InformHostOfCacheStats,
85 weak_factory_.GetWeakPtr()), 85 weak_factory_.GetWeakPtr()),
86 base::TimeDelta::FromMilliseconds(kCacheStatsDelayMS)); 86 base::TimeDelta::FromMilliseconds(kCacheStatsDelayMS));
87 } 87 }
88 88
89 if (error_code == net::ERR_ABORTED) { 89 if (error_code == net::ERR_ABORTED) {
90 return NULL; 90 return NULL;
91 } 91 }
92 92
93 // Resource canceled with a specific error are filtered. 93 // Resource canceled with a specific error are filtered.
94 return SecurityFilterPeer::CreateSecurityFilterPeerForDeniedRequest( 94 return SecurityFilterPeer::CreateSecurityFilterPeerForDeniedRequest(
95 resource_type, current_peer, error_code); 95 resource_type, current_peer, error_code);
96 } 96 }
97 97
98 virtual webkit_glue::ResourceLoaderBridge::Peer* OnReceivedResponse( 98 virtual content::ResourceLoaderBridge::Peer* OnReceivedResponse(
99 webkit_glue::ResourceLoaderBridge::Peer* current_peer, 99 content::ResourceLoaderBridge::Peer* current_peer,
100 const std::string& mime_type, 100 const std::string& mime_type,
101 const GURL& url) OVERRIDE { 101 const GURL& url) OVERRIDE {
102 return ExtensionLocalizationPeer::CreateExtensionLocalizationPeer( 102 return ExtensionLocalizationPeer::CreateExtensionLocalizationPeer(
103 current_peer, RenderThread::Get(), mime_type, url); 103 current_peer, RenderThread::Get(), mime_type, url);
104 } 104 }
105 105
106 private: 106 private:
107 void InformHostOfCacheStats() { 107 void InformHostOfCacheStats() {
108 WebCache::UsageStats stats; 108 WebCache::UsageStats stats;
109 WebCache::getUsageStats(&stats); 109 WebCache::getUsageStats(&stats);
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 if (clear_cache_pending_ && webkit_initialized_) { 443 if (clear_cache_pending_ && webkit_initialized_) {
444 clear_cache_pending_ = false; 444 clear_cache_pending_ = false;
445 WebCache::clear(); 445 WebCache::clear();
446 } 446 }
447 } 447 }
448 448
449 const RendererContentSettingRules* 449 const RendererContentSettingRules*
450 ChromeRenderProcessObserver::content_setting_rules() const { 450 ChromeRenderProcessObserver::content_setting_rules() const {
451 return &content_setting_rules_; 451 return &content_setting_rules_;
452 } 452 }
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/extensions/extension_localization_peer.h » ('j') | content/public/child/resource_loader_bridge.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698