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

Side by Side Diff: chrome/browser/task_management/providers/task_provider.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: Converting size_t's to int64's Created 5 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
OLDNEW
(Empty)
1 // Copyright 2015 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_MANAGEMENT_PROVIDERS_TASK_PROVIDER_H_
6 #define CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_TASK_PROVIDER_H_
7
8 #include "chrome/browser/task_management/providers/task_provider_observer.h"
9
10 namespace task_management {
11
12 // Defines the interface for task providers. A concrete task provider must be
13 // able to collect all the tasks of a particular type which this provider
14 // supports as well as track any tasks addition / removal. Once StartUpdating()
15 // is called, the provider is responsible for notifying the observer about the
16 // tasks it's tracking. The TaskProviders own the tasks they provide.
17 class TaskProvider {
18 public:
19 TaskProvider();
20 virtual ~TaskProvider();
21
22 // Should return the task associated to the specified IDs from a
23 // |content::ResourceRequestInfo| that represents a |URLRequest|. A value of
24 // nullptr will be returned if the desired task does not belong to this
25 // provider.
26 //
27 // |origin_pid| is the PID of the originating process of the URLRequest, if
28 // the request is sent on behalf of another process. Otherwise it's 0.
29 // |child_id| is the unique ID of the host of the child process requestor.
30 // |route_id| is the ID of the IPC route for the URLRequest (this identifies
31 // the RenderView or like-thing in the renderer that the request gets routed
32 // to).
33 virtual Task* GetTaskOfUrlRequest(int origin_pid,
34 int child_id,
35 int route_id) = 0;
36
37 // Set the sole observer of this provider. It's an error to set an observer
38 // if there's already one there.
39 void SetObserver(TaskProviderObserver* observer);
40
41 // Clears the currently set observer for this provider. It's an error to clear
42 // the observer if there's no one set.
43 void ClearObserver();
44
45 protected:
46 // Used by concrete task providers to notify the observer of tasks addition/
47 // removal. These methods should only be called after StartUpdating() has been
48 // called and before StopUpdating() is called.
49 void NotifyObserverTaskAdded(Task* task) const;
50 void NotifyObserverTaskRemoved(Task* task) const;
51
52 private:
53 // This will be called once an observer is set for this provider. When it is
54 // called, the concrete provider must notify the observer of all pre-existing
55 // tasks as well as track new addition and terminations and notify the
56 // observer of these changes.
57 virtual void StartUpdating() = 0;
58
59 // This will be called once the observer is cleared, at which point the
60 // provider can stop tracking tasks addition / removal and can clear its own
61 // resources.
62 virtual void StopUpdating() = 0;
63
64 // We support only one single obsever which will be the sampler in this case.
65 TaskProviderObserver* observer_;
66
67 DISALLOW_COPY_AND_ASSIGN(TaskProvider);
68 };
69
70 } // namespace task_management
71
72 #endif // CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_TASK_PROVIDER_H_
OLDNEW
« no previous file with comments | « chrome/browser/task_management/providers/task.cc ('k') | chrome/browser/task_management/providers/task_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698