| OLD | NEW |
| (Empty) |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_TASK_MANAGER_BROWSER_PROCESS_RESOURCE_PROVIDER_H_ | |
| 6 #define CHROME_BROWSER_TASK_MANAGER_BROWSER_PROCESS_RESOURCE_PROVIDER_H_ | |
| 7 | |
| 8 #include <stddef.h> | |
| 9 | |
| 10 #include "base/compiler_specific.h" | |
| 11 #include "base/macros.h" | |
| 12 #include "chrome/browser/task_manager/resource_provider.h" | |
| 13 #include "content/public/browser/browser_child_process_observer.h" | |
| 14 #include "content/public/browser/child_process_data.h" | |
| 15 #include "content/public/browser/notification_observer.h" | |
| 16 #include "content/public/browser/notification_registrar.h" | |
| 17 #include "content/public/common/process_type.h" | |
| 18 | |
| 19 class TaskManager; | |
| 20 | |
| 21 namespace content { | |
| 22 class RenderViewHost; | |
| 23 class WebContents; | |
| 24 } | |
| 25 | |
| 26 namespace extensions { | |
| 27 class Extension; | |
| 28 } | |
| 29 | |
| 30 namespace task_manager { | |
| 31 | |
| 32 class BrowserProcessResource : public Resource { | |
| 33 public: | |
| 34 BrowserProcessResource(); | |
| 35 ~BrowserProcessResource() override; | |
| 36 | |
| 37 // Resource methods: | |
| 38 base::string16 GetTitle() const override; | |
| 39 base::string16 GetProfileName() const override; | |
| 40 gfx::ImageSkia GetIcon() const override; | |
| 41 base::ProcessHandle GetProcess() const override; | |
| 42 int GetUniqueChildProcessId() const override; | |
| 43 Type GetType() const override; | |
| 44 | |
| 45 bool SupportNetworkUsage() const override; | |
| 46 void SetSupportNetworkUsage() override; | |
| 47 | |
| 48 bool ReportsSqliteMemoryUsed() const override; | |
| 49 size_t SqliteMemoryUsedBytes() const override; | |
| 50 | |
| 51 bool ReportsV8MemoryStats() const override; | |
| 52 size_t GetV8MemoryAllocated() const override; | |
| 53 size_t GetV8MemoryUsed() const override; | |
| 54 | |
| 55 private: | |
| 56 mutable base::string16 title_; | |
| 57 | |
| 58 static gfx::ImageSkia* default_icon_; | |
| 59 | |
| 60 DISALLOW_COPY_AND_ASSIGN(BrowserProcessResource); | |
| 61 }; | |
| 62 | |
| 63 class BrowserProcessResourceProvider : public ResourceProvider { | |
| 64 public: | |
| 65 explicit BrowserProcessResourceProvider(TaskManager* task_manager); | |
| 66 | |
| 67 Resource* GetResource(int origin_pid, int child_id, int route_id) override; | |
| 68 void StartUpdating() override; | |
| 69 void StopUpdating() override; | |
| 70 | |
| 71 // Whether we are currently reporting to the task manager. Used to ignore | |
| 72 // notifications sent after StopUpdating(). | |
| 73 bool updating_; | |
| 74 | |
| 75 private: | |
| 76 ~BrowserProcessResourceProvider() override; | |
| 77 | |
| 78 TaskManager* task_manager_; | |
| 79 BrowserProcessResource resource_; | |
| 80 | |
| 81 DISALLOW_COPY_AND_ASSIGN(BrowserProcessResourceProvider); | |
| 82 }; | |
| 83 | |
| 84 } // namespace task_manager | |
| 85 | |
| 86 #endif // CHROME_BROWSER_TASK_MANAGER_BROWSER_PROCESS_RESOURCE_PROVIDER_H_ | |
| OLD | NEW |