diff options
author | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-22 10:21:21 +0000 |
---|---|---|
committer | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-22 10:23:54 +0000 |
commit | b48fe9eef7e42d61be675211ee98b7cc18fa941a (patch) | |
tree | a2443eae0cbf7db1ee71d5d736d602853c549c8c /athena/content/app_activity.cc | |
parent | a9ca8d58432a4312b98a2e3bb0c90443bce839c6 (diff) | |
download | chromium_src-b48fe9eef7e42d61be675211ee98b7cc18fa941a.zip chromium_src-b48fe9eef7e42d61be675211ee98b7cc18fa941a.tar.gz chromium_src-b48fe9eef7e42d61be675211ee98b7cc18fa941a.tar.bz2 |
Revert 291221 "Athena: Adding basic resource management framewor..."
Reason: Failure on ASAN build bots.
https://build.chromium.org/p/chromium.memory/builders/Linux%20Chromium%20OS%20ASan%20LSan%20Tests%20(3)/builds/2854/steps/athena_unittests/logs/OneAppActivity
> Athena: Adding basic resource management framework (un-/re-loading) of V2 applications
>
> Functionality:
>
> The |AppRegistry| has for each running application an |AppActivityRegistry|.
>
> The |AppActivityRegistry| knows all activities associated with the application it represents.
> It can furthermore shut the app entirely down upon resource manager request. It will then create
> an |AppActivityProxy| for the overview mode which shows a placeholder for an unloaded app. This
> placeholder can then ask the |AppActivityRegistry| to restart the application again.
>
> A shutdown request for the application is only performed when all activities were marked for
> UNLOAD.
>
> If there were multiple activities upon shutdown for one app, the app has to take care of
> re-creating all windows and thus re-creating all activities. Since an activity match cannot
> be performed, the |AppActivityProxy| will only be shown once and it will show in the location
> of the most recently used activity of that app. If we later on find an app which really uses
> multiple windows and it is imperative to keep the history for all of them tact & the app is
> recreating them properly, (a lot of if's) we can revisit the single |AppActivityProxy| and
> try to address it in a cleaner way, but at this time that seems rather un-useful since it is
> not known if required.
>
> BUG=388085
> TEST=AppActivityTest.*
>
> Review URL: https://codereview.chromium.org/477523002
TBR=skuhne@chromium.org
Review URL: https://codereview.chromium.org/497013002
Cr-Commit-Position: refs/heads/master@{#291370}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@291370 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'athena/content/app_activity.cc')
-rw-r--r-- | athena/content/app_activity.cc | 65 |
1 files changed, 14 insertions, 51 deletions
diff --git a/athena/content/app_activity.cc b/athena/content/app_activity.cc index 309454a..c90daff 100644 --- a/athena/content/app_activity.cc +++ b/athena/content/app_activity.cc @@ -5,13 +5,9 @@ #include "athena/content/app_activity.h" #include "athena/activity/public/activity_manager.h" -#include "athena/content/app_activity_registry.h" -#include "athena/content/public/app_content_control_delegate.h" -#include "athena/content/public/app_registry.h" #include "content/public/browser/web_contents.h" #include "extensions/shell/browser/shell_app_window.h" #include "ui/views/controls/webview/webview.h" -#include "ui/views/widget/widget.h" namespace athena { @@ -19,14 +15,13 @@ namespace athena { AppActivity::AppActivity(extensions::ShellAppWindow* app_window) : app_window_(app_window), web_view_(NULL), - current_state_(ACTIVITY_UNLOADED), - app_activity_registry_(NULL) { + current_state_(ACTIVITY_UNLOADED) { + DCHECK(app_window_); } AppActivity::~AppActivity() { - // If this activity is registered, we unregister it now. - if (app_activity_registry_) - app_activity_registry_->UnregisterAppActivity(this); + if (GetCurrentState() != ACTIVITY_UNLOADED) + SetCurrentState(ACTIVITY_UNLOADED); } ActivityViewModel* AppActivity::GetActivityViewModel() { @@ -34,41 +29,35 @@ ActivityViewModel* AppActivity::GetActivityViewModel() { } void AppActivity::SetCurrentState(Activity::ActivityState state) { - ActivityState current_state = state; - // Remember the last requested state now so that a call to GetCurrentState() - // returns the new state. - current_state_ = state; - switch (state) { case ACTIVITY_VISIBLE: // Fall through (for the moment). case ACTIVITY_INVISIBLE: // By clearing the overview mode image we allow the content to be shown. overview_mode_image_ = gfx::ImageSkia(); - // Note: A reload from the unloaded state will be performed through the - // |AppActivityProxy| object and no further action isn't necessary here. + // TODO(skuhne): Find out how to reload an app from the extension system. break; case ACTIVITY_BACKGROUND_LOW_PRIORITY: - DCHECK(ACTIVITY_VISIBLE == current_state || - ACTIVITY_INVISIBLE == current_state); + DCHECK(ACTIVITY_VISIBLE == current_state_ || + ACTIVITY_INVISIBLE == current_state_); // TODO(skuhne): Do this. break; case ACTIVITY_PERSISTENT: - DCHECK_EQ(ACTIVITY_BACKGROUND_LOW_PRIORITY, current_state); + DCHECK_EQ(ACTIVITY_BACKGROUND_LOW_PRIORITY, current_state_); // TODO(skuhne): Do this. break; case ACTIVITY_UNLOADED: - DCHECK_NE(ACTIVITY_UNLOADED, current_state); - // This will cause the application to shut down, close its windows and - // delete this object. Instead a |AppActivityProxy| will be created as - // place holder. - if (app_activity_registry_) - app_activity_registry_->Unload(); + DCHECK_NE(ACTIVITY_UNLOADED, current_state_); + // TODO(skuhne): Find out how to evict an app from the extension system. + // web_view_->EvictContent(); break; } + // Remember the last requested state. + current_state_ = state; } Activity::ActivityState AppActivity::GetCurrentState() { + // TODO(skuhne): Check here also eviction status. if (!web_view_) { DCHECK_EQ(ACTIVITY_UNLOADED, current_state_); return ACTIVITY_UNLOADED; @@ -93,10 +82,6 @@ Activity::ActivityMediaState AppActivity::GetMediaState() { return Activity::ACTIVITY_MEDIA_STATE_NONE; } -aura::Window* AppActivity::GetWindow() { - return !web_view_ ? NULL : web_view_->GetWidget()->GetNativeWindow(); -} - void AppActivity::Init() { } @@ -145,26 +130,4 @@ void AppActivity::DidUpdateFaviconURL( ActivityManager::Get()->UpdateActivity(this); } -void AppActivity::DidStartNavigationToPendingEntry( - const GURL& url, - content::NavigationController::ReloadType reload_type) { - if (!app_activity_registry_) - RegisterActivity(); -} - -// Register an |activity| with an application. -// Note: This should only get called once for an |app_window| of the -// |activity|. -void AppActivity::RegisterActivity() { - content::WebContents* web_contents = app_window_->GetAssociatedWebContents(); - AppRegistry* app_registry = AppRegistry::Get(); - // Get the application's registry. - app_activity_registry_ = app_registry->GetAppActivityRegistry( - app_registry->GetDelegate()->GetApplicationID(web_contents), - web_contents->GetBrowserContext()); - DCHECK(app_activity_registry_); - // Register the activity. - app_activity_registry_->RegisterAppActivity(this); -} - } // namespace athena |