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

Unified Diff: athena/activity/public/activity.h

Issue 358003002: Additions to Activities to allow resource management (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | athena/activity/public/activity_view_model.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: athena/activity/public/activity.h
diff --git a/athena/activity/public/activity.h b/athena/activity/public/activity.h
index 600182fd4f15ec017c5008f27fb914e13d262203..74a6c41123612bf482eb17c9343ed125fa6bff0a 100644
--- a/athena/activity/public/activity.h
+++ b/athena/activity/public/activity.h
@@ -13,12 +13,65 @@ namespace athena {
class ActivityViewModel;
+// This class is a high level abstraction of an activity (which could be either
+// a web page or a V1/V2 app/extension). Through this class the activity can
+// be controlled (e.g. loaded / unloaded).
+// An Activity gets created with state |ACTIVITY_UNLOADED|.
+// Requesting |ACTIVITY_VISIBLE| or |ACTIVITY_INVISIBLE| will load it.
+// Once an activity was |ACTIVITY_INVISIBLE| for a while it can be transitioned
+// into |ACTIVITY_BACKGROUND_LOW_PRIORITY| to surrender more resources. After
+// more time it can be transitions to |ACTIVITY_PERSISTENT| in which it only
+// has it's runtime state left. At any time it can be transitioned back to one
+// of the higher levels or unloaded via |ACTIVITY_UNLOADED|.
+// Note that the resource manager will also query the media state before
+// deciding if an activity can put into a lower state then |ACTIVITY_INVISIBLE|.
class ATHENA_EXPORT Activity {
public:
+ // The state of an activity which could either be set or requested by e.g. the
+ // resource management system.
+ enum ActivityState {
+ // The activity is allowed to have gpu compositor layers and can be visible.
+ ACTIVITY_VISIBLE,
+ // The activity does not have gpu compositing layers, will not be visible
+ // and will be treated as a background priority task.
+ ACTIVITY_INVISIBLE,
+ // The activity should surrender additional resources. This has only an
+ // effect when the activity is in a loaded state (Visible, Active, Hidden).
+ ACTIVITY_BACKGROUND_LOW_PRIORITY,
+ // The activity will only keep a minimum set of resources to get back to the
+ // running state. It will get stalled however. Note that it is not possible
+ // to get into this state from the |ACTIVITY_UNLOADED| state.
+ ACTIVITY_PERSISTENT,
+ // Unloads the activity and can be called in any state - but unloaded.
+ ACTIVITY_UNLOADED
+ };
+
+ // This enum declares the media state the activity is in.
+ // TODO(skuhne): Move the |TabMediaState| out of chrome and combine it in a
+ // media library within content and then use that enum instead.
+ enum ActivityMediaState {
+ ACTIVITY_MEDIA_STATE_NONE,
+ ACTIVITY_MEDIA_STATE_RECORDING, // Audio/Video being recorded by activity.
+ ACTIVITY_MEDIA_STATE_CAPTURING, // Activity is being captured.
+ ACTIVITY_MEDIA_STATE_AUDIO_PLAYING // Audible audio is playing in activity.
+ };
+
virtual ~Activity();
// The Activity retains ownership of the returned view-model.
virtual ActivityViewModel* GetActivityViewModel() = 0;
+
+ // Transition the activity into a new state.
+ virtual void SetCurrentState(ActivityState state) = 0;
+
+ // Returns the current state of the activity.
+ virtual ActivityState GetCurrentState() = 0;
+
+ // Returns if the activity is visible or not.
+ virtual bool IsVisible() = 0;
+
+ // Returns the current media state.
+ virtual ActivityMediaState GetMediaState() = 0;
};
} // namespace athena
« no previous file with comments | « no previous file | athena/activity/public/activity_view_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698