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

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

Issue 7222023: Forward handling of low-mem message to the content renderer client. Add APIs to handle this case. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fix constructor Created 9 years, 5 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CHROME_RENDERER_CHROME_RENDER_PROCESS_OBSERVER_H_ 5 #ifndef CHROME_RENDERER_CHROME_RENDER_PROCESS_OBSERVER_H_
6 #define CHROME_RENDERER_CHROME_RENDER_PROCESS_OBSERVER_H_ 6 #define CHROME_RENDERER_CHROME_RENDER_PROCESS_OBSERVER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "content/common/notification_observer.h"
14 #include "content/common/notification_registrar.h"
13 #include "content/renderer/render_process_observer.h" 15 #include "content/renderer/render_process_observer.h"
14 16
15 class GURL; 17 class GURL;
16 class ResourceDispatcherDelegate; 18 class ResourceDispatcherDelegate;
17 struct ContentSettings; 19 struct ContentSettings;
18 20
19 // This class filters the incoming control messages (i.e. ones not destined for 21 // This class filters the incoming control messages (i.e. ones not destined for
20 // a RenderView) for Chrome specific messages that the content layer doesn't 22 // a RenderView) for Chrome specific messages that the content layer doesn't
21 // happen. If a few messages are related, they should probably have their own 23 // happen. If a few messages are related, they should probably have their own
22 // observer. 24 // observer.
23 class ChromeRenderProcessObserver : public RenderProcessObserver { 25 class ChromeRenderProcessObserver : public RenderProcessObserver,
26 public NotificationObserver {
24 public: 27 public:
25 ChromeRenderProcessObserver(); 28 ChromeRenderProcessObserver();
26 virtual ~ChromeRenderProcessObserver(); 29 virtual ~ChromeRenderProcessObserver();
27 30
28 static bool is_incognito_process() { return is_incognito_process_; } 31 static bool is_incognito_process() { return is_incognito_process_; }
29 32
33 // NotificationObserver
34 void Observe(int type,
35 const NotificationSource& source,
36 const NotificationDetails& details) OVERRIDE;
37
30 private: 38 private:
31 // RenderProcessObserver implementation. 39 // RenderProcessObserver implementation.
32 virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; 40 virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE;
33 virtual void WebKitInitialized() OVERRIDE; 41 virtual void WebKitInitialized() OVERRIDE;
34 42
35 void OnSetIsIncognitoProcess(bool is_incognito_process); 43 void OnSetIsIncognitoProcess(bool is_incognito_process);
36 void OnSetContentSettingsForCurrentURL( 44 void OnSetContentSettingsForCurrentURL(
37 const GURL& url, const ContentSettings& content_settings); 45 const GURL& url, const ContentSettings& content_settings);
38 void OnSetDefaultContentSettings(const ContentSettings& content_settings); 46 void OnSetDefaultContentSettings(const ContentSettings& content_settings);
39 void OnSetCacheCapacities(size_t min_dead_capacity, 47 void OnSetCacheCapacities(size_t min_dead_capacity,
40 size_t max_dead_capacity, 48 size_t max_dead_capacity,
41 size_t capacity); 49 size_t capacity);
42 void OnClearCache(); 50 void OnClearCache();
43 void OnGetCacheResourceStats(); 51 void OnGetCacheResourceStats();
44 void OnSetFieldTrialGroup(const std::string& fiel_trial_name, 52 void OnSetFieldTrialGroup(const std::string& fiel_trial_name,
45 const std::string& group_name); 53 const std::string& group_name);
46 void OnGetRendererTcmalloc(); 54 void OnGetRendererTcmalloc();
47 void OnGetV8HeapStats(); 55 void OnGetV8HeapStats();
48 void OnPurgeMemory(); 56 void OnPurgeMemory();
49 57
50 static bool is_incognito_process_; 58 static bool is_incognito_process_;
51 scoped_ptr<ResourceDispatcherDelegate> resource_delegate_; 59 scoped_ptr<ResourceDispatcherDelegate> resource_delegate_;
52 60
61 NotificationRegistrar registrar_;
62
53 DISALLOW_COPY_AND_ASSIGN(ChromeRenderProcessObserver); 63 DISALLOW_COPY_AND_ASSIGN(ChromeRenderProcessObserver);
54 }; 64 };
55 65
56 #endif // CHROME_RENDERER_CHROME_RENDER_PROCESS_OBSERVER_H_ 66 #endif // CHROME_RENDERER_CHROME_RENDER_PROCESS_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698