| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/extensions/extension_processes_api.h" | 5 #include "chrome/browser/extensions/extension_processes_api.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 static_cast<int64>(mem) : -1; | 128 static_cast<int64>(mem) : -1; |
| 129 | 129 |
| 130 // Store each process indexed by the string version of its id | 130 // Store each process indexed by the string version of its id |
| 131 processes->Set(base::IntToString(id), | 131 processes->Set(base::IntToString(id), |
| 132 CreateProcessValue(id, type, cpu, net, pr_mem, sh_mem)); | 132 CreateProcessValue(id, type, cpu, net, pr_mem, sh_mem)); |
| 133 } | 133 } |
| 134 } | 134 } |
| 135 args.Append(processes); | 135 args.Append(processes); |
| 136 | 136 |
| 137 std::string json_args; | 137 std::string json_args; |
| 138 base::JSONWriter::Write(&args, false, &json_args); | 138 base::JSONWriter::Write(&args, &json_args); |
| 139 | 139 |
| 140 // Notify each profile that is interested. | 140 // Notify each profile that is interested. |
| 141 for (ProfileSet::iterator it = profiles_.begin(); | 141 for (ProfileSet::iterator it = profiles_.begin(); |
| 142 it != profiles_.end(); it++) { | 142 it != profiles_.end(); it++) { |
| 143 Profile* profile = *it; | 143 Profile* profile = *it; |
| 144 DispatchEvent(profile, keys::kOnUpdated, json_args); | 144 DispatchEvent(profile, keys::kOnUpdated, json_args); |
| 145 } | 145 } |
| 146 } | 146 } |
| 147 } | 147 } |
| 148 | 148 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 168 base::IntToString(tab_id)); | 168 base::IntToString(tab_id)); |
| 169 return false; | 169 return false; |
| 170 } | 170 } |
| 171 | 171 |
| 172 // Return the process ID of the tab as an integer. | 172 // Return the process ID of the tab as an integer. |
| 173 int id = base::GetProcId(contents->web_contents()-> | 173 int id = base::GetProcId(contents->web_contents()-> |
| 174 GetRenderProcessHost()->GetHandle()); | 174 GetRenderProcessHost()->GetHandle()); |
| 175 result_.reset(Value::CreateIntegerValue(id)); | 175 result_.reset(Value::CreateIntegerValue(id)); |
| 176 return true; | 176 return true; |
| 177 } | 177 } |
| OLD | NEW |