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

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: Addressed 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
« no previous file with comments | « athena/content/app_activity_registry.h ('k') | athena/content/app_activity_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..e6b70d5806376fd32d0c2b23e2c3bbfcfbe8b1ab 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,13 @@ 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());
- }
+ // This function can be called through an observer call. When that happens,
+ // several activities will be closed / started. That can then cause a crash.
+ // We postpone therefore the activity destruction till after the observer is
+ // done.
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE,
+ base::Bind(&AppActivityRegistry::DelayedUnload, base::Unretained(this)));
}
void AppActivityRegistry::ProxyDestroyed(AppActivityProxy* proxy) {
@@ -103,6 +109,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 =
« no previous file with comments | « athena/content/app_activity_registry.h ('k') | athena/content/app_activity_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698