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

Unified Diff: athena/content/app_activity_registry.cc

Issue 548633005: Adding overview / layer framework to Activities so that unloaded / sleeping activities can be shown… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased, fixed resulting problems and addressed comments Created 6 years, 3 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: athena/content/app_activity_registry.cc
diff --git a/athena/content/app_activity_registry.cc b/athena/content/app_activity_registry.cc
index 24505df40992550e3e2922d23ecc7de1512ee8a9..23ec42c7670e0f88e8c68088416a1f66149eb360 100644
--- a/athena/content/app_activity_registry.cc
+++ b/athena/content/app_activity_registry.cc
@@ -12,6 +12,10 @@
#include "athena/resource_manager/public/resource_manager.h"
#include "athena/wm/public/window_list_provider.h"
#include "athena/wm/public/window_manager.h"
+#include "base/bind.h"
+#include "base/location.h"
+#include "base/single_thread_task_runner.h"
+#include "base/thread_task_runner_handle.h"
#include "ui/aura/window.h"
#include "ui/views/view.h"
#include "ui/views/widget/widget.h"
@@ -79,11 +83,11 @@ void AppActivityRegistry::Unload() {
unloaded_activity_proxy_ = new AppActivityProxy(GetMruActivity(), this);
ActivityManager::Get()->AddActivity(unloaded_activity_proxy_);
- // Unload the application. This operation will be asynchronous.
- if (!ExtensionsDelegate::Get(browser_context_)->UnloadApp(app_id_)) {
- while(!activity_list_.empty())
- Activity::Delete(activity_list_.back());
- }
+ // Unload the application asynchronously to avoid the activity destruction
+ // while we are in an observerloop.
sadrul 2014/09/12 16:30:14 I am not sure what this means, but if you mean whi
Mr4D (OOO till 08-26) 2014/09/12 20:11:26 Updated the comment. But I do not remember exactl
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE,
+ base::Bind(&AppActivityRegistry::DelayedUnload, base::Unretained(this)));
}
void AppActivityRegistry::ProxyDestroyed(AppActivityProxy* proxy) {
@@ -103,6 +107,13 @@ void AppActivityRegistry::RestartApplication(AppActivityProxy* proxy) {
ExtensionsDelegate::Get(browser_context_)->LaunchApp(app_id_);
}
+void AppActivityRegistry::DelayedUnload() {
+ if (!ExtensionsDelegate::Get(browser_context_)->UnloadApp(app_id_)) {
+ while(!activity_list_.empty())
+ Activity::Delete(activity_list_.back());
+ }
+}
+
AppActivity* AppActivityRegistry::GetMruActivity() {
DCHECK(activity_list_.size());
WindowListProvider* window_list_provider =

Powered by Google App Engine
This is Rietveld 408576698