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

Side by Side Diff: chrome/browser/task_manager/providers/arc/arc_process_task.cc

Issue 2625823005: arc: Fix crash in arc_process_task.cc during browser shutdown (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/task_manager/providers/arc/arc_process_task.h" 5 #include "chrome/browser/task_manager/providers/arc/arc_process_task.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/i18n/rtl.h" 8 #include "base/i18n/rtl.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 if (result == arc::ActivityIconLoader::GetResult::FAILED_ARC_NOT_READY) { 106 if (result == arc::ActivityIconLoader::GetResult::FAILED_ARC_NOT_READY) {
107 // Need to retry loading the icon. 107 // Need to retry loading the icon.
108 arc::ArcServiceManager::Get() 108 arc::ArcServiceManager::Get()
109 ->arc_bridge_service() 109 ->arc_bridge_service()
110 ->intent_helper() 110 ->intent_helper()
111 ->AddObserver(this); 111 ->AddObserver(this);
112 } 112 }
113 } 113 }
114 114
115 ArcProcessTask::~ArcProcessTask() { 115 ArcProcessTask::~ArcProcessTask() {
116 arc::ArcServiceManager::Get() 116 auto* service_manager = arc::ArcServiceManager::Get();
117 ->arc_bridge_service() 117 // This destructor can also be called when TaskManagerImpl is destructed.
118 ->intent_helper() 118 // Since TaskManagerImpl is a LAZY_INSTANCE, arc::ArcServiceManager may have
119 ->RemoveObserver(this); 119 // already been destructed. In that case, arc_bridge_service() has also been
120 // destructed, and it is safe to just return.
121 if (!service_manager)
122 return;
123 service_manager->arc_bridge_service()->intent_helper()->RemoveObserver(this);
120 } 124 }
121 125
122 Task::Type ArcProcessTask::GetType() const { 126 Task::Type ArcProcessTask::GetType() const {
123 return Task::ARC; 127 return Task::ARC;
124 } 128 }
125 129
126 int ArcProcessTask::GetChildProcessUniqueID() const { 130 int ArcProcessTask::GetChildProcessUniqueID() const {
127 // ARC process is not a child process of the browser. 131 // ARC process is not a child process of the browser.
128 return content::ChildProcessHost::kInvalidUniqueID; 132 return content::ChildProcessHost::kInvalidUniqueID;
129 } 133 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 for (const auto& kv : *icons) { 174 for (const auto& kv : *icons) {
171 const gfx::Image& icon = kv.second.icon16; 175 const gfx::Image& icon = kv.second.icon16;
172 if (icon.IsEmpty()) 176 if (icon.IsEmpty())
173 continue; 177 continue;
174 set_icon(*icon.ToImageSkia()); 178 set_icon(*icon.ToImageSkia());
175 break; // Since the parent class can hold only one icon, break here. 179 break; // Since the parent class can hold only one icon, break here.
176 } 180 }
177 } 181 }
178 182
179 } // namespace task_manager 183 } // namespace task_manager
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698