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

Unified Diff: chrome/browser/task_management/providers/task.h

Issue 1038033002: New Task Manager - Phase 1.1: Implement Browser Process Task Providing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unconventional comments Created 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/task_management/providers/task.h
diff --git a/chrome/browser/task_management/providers/task.h b/chrome/browser/task_management/providers/task.h
new file mode 100644
index 0000000000000000000000000000000000000000..2ae428cd3929aa2fe2b85502498aedaf331b2652
--- /dev/null
+++ b/chrome/browser/task_management/providers/task.h
@@ -0,0 +1,104 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_TASK_H_
+#define CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_TASK_H_
+
+#include "base/basictypes.h"
+#include "base/process/process_handle.h"
+#include "base/strings/string16.h"
+#include "base/time/time.h"
+#include "third_party/WebKit/public/web/WebCache.h"
+#include "ui/gfx/image/image_skia.h"
+
+namespace task_management {
+
+// Defines a task that corresponds to a tab, an app, an extension, ... etc. It
+// represents one row in the task manager table. Multiple tasks can share the
+// same process, in which case they're grouped together in the task manager
+// table. See |task_management::TaskGroup| which represents a process possibly
+// shared by multiple tasks.
+class Task {
+ public:
+ enum Type {
+ UNKNOWN = 0,
+ BROWSER, /* The main browser process. */
+ RENDERER, /* A normal WebContents renderer process. */
+ EXTENSION, /* An extension or app process. */
+ NOTIFICATION, /* A notification process. */
+ GUEST, /* A browser plugin guest process. */
+ PLUGIN, /* A plugin process. */
+ WORKER, /* A web worker process. */
+ NACL, /* A NativeClient loader or broker process. */
+ UTILITY, /* A browser utility process. */
+ ZYGOTE, /* A Linux zygote process. */
+ SANDBOX_HELPER, /* A sandbox helper process. */
+ GPU, /* A graphics process. */
+ };
+
+ Task(const base::string16& title,
+ const gfx::ImageSkia& icon,
+ base::ProcessHandle handle);
+ virtual ~Task();
+
+ // Returns the task type.
+ virtual Type GetType() const = 0;
+
+ // This is the unique ID of the BrowserChildProcessHost/RenderProcessHost. It
+ // is not the PID nor the handle of the process.
+ virtual int GetChildProcessUniqueID() const = 0;
+
+ virtual base::string16 GetProfileName() const;
+
+ virtual int GetRoutingID() const;
+
+ // Returns the Sqlite used memory (in bytes). Not all tasks reports Sqlite
+ // memory, in this case a default invalid value of -1U will be returned.
+ virtual size_t GetSqliteMemoryUsed() const;
+
+ // Returns the allocated and used V8 memory (in bytes). Not all tasks reports
+ // V8 memory, in this case a default invalid value of -1U will be returned.
+ virtual size_t GetV8MemoryAllocated() const;
+ virtual size_t GetV8MemoryUsed() const;
+
+ // Checking if the task reports Webkit resource cache statistics and getting
+ // them if it does.
+ virtual bool ReportsWebCacheStats() const;
+ virtual blink::WebCache::ResourceTypeStats GetWebCacheStats() const;
+
+ // Will be called to let the task refresh itself between refresh cycles.
+ // |update_duration| is the time since the last task manager refresh.
+ virtual void Refresh(const base::TimeDelta& update_duration);
+
+ // Will receive this notification through the task manager from
+ // |ChromeNetworkDelegate::OnRawBytesRead()|. The task will add to the
+ // |current_byte_count_| in this refresh cycle.
+ void OnBytesRead(int64 bytes_read);
+
+ int64 network_usage() const { return network_usage_; }
+ int64 task_id() const { return task_id_; }
+ base::string16 title() const { return title_; }
+ gfx::ImageSkia icon() const { return icon_; }
+ base::ProcessHandle process_handle() const { return process_handle_; }
+ bool is_first_in_group() const { return is_first_in_group_; }
+ void set_is_first_in_group(bool val) { is_first_in_group_ = val; }
ncarter (slow) 2015/03/31 22:31:32 Representing "first in group" as a bool member of
afakhry 2015/03/31 23:44:14 Done.
+
+ private:
+ static int64 last_id_;
+
+ // This is the unique ID of this task.
+ int64 task_id_;
+ int64 network_usage_;
+ int64 current_byte_count_;
+ base::string16 title_;
+ gfx::ImageSkia icon_;
+ base::ProcessHandle process_handle_;
+ bool is_first_in_group_;
+
+ DISALLOW_COPY_AND_ASSIGN(Task);
+};
+
+} // namespace task_management
+
+#endif // CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_TASK_H_

Powered by Google App Engine
This is Rietveld 408576698