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

Side by Side Diff: chrome/browser/memory_details_linux.cc

Issue 9463029: Add an API around zygoteHost so that chrome doesn't reach into the internal content implementation. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix clang Created 8 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/memory_details.cc ('k') | chrome/browser/oom_priority_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/memory_details.h" 5 #include "chrome/browser/memory_details.h"
6 6
7 #include <dirent.h> 7 #include <dirent.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <unistd.h> 9 #include <unistd.h>
10 10
11 #include <set> 11 #include <set>
12 12
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/eintr_wrapper.h" 14 #include "base/eintr_wrapper.h"
15 #include "base/file_version_info.h" 15 #include "base/file_version_info.h"
16 #include "base/process_util.h" 16 #include "base/process_util.h"
17 #include "base/string_util.h" 17 #include "base/string_util.h"
18 #include "base/utf_string_conversions.h" 18 #include "base/utf_string_conversions.h"
19 #include "chrome/common/chrome_constants.h" 19 #include "chrome/common/chrome_constants.h"
20 #include "chrome/common/url_constants.h" 20 #include "chrome/common/url_constants.h"
21 #include "content/browser/zygote_host_linux.h"
22 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
22 #include "content/public/browser/zygote_host_linux.h"
23 #include "content/public/common/process_type.h" 23 #include "content/public/common/process_type.h"
24 #include "grit/chromium_strings.h" 24 #include "grit/chromium_strings.h"
25 25
26 using content::BrowserThread; 26 using content::BrowserThread;
27 27
28 // Known browsers which we collect details for. 28 // Known browsers which we collect details for.
29 enum BrowserType { 29 enum BrowserType {
30 CHROME = 0, 30 CHROME = 0,
31 FIREFOX, 31 FIREFOX,
32 ICEWEASEL, 32 ICEWEASEL,
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 } 232 }
233 } 233 }
234 } 234 }
235 235
236 if (!found_parent) 236 if (!found_parent)
237 browsers_found.insert(i->pid); 237 browsers_found.insert(i->pid);
238 } 238 }
239 } 239 }
240 240
241 std::vector<pid_t> current_browser_processes; 241 std::vector<pid_t> current_browser_processes;
242 const pid_t zygote = ZygoteHost::GetInstance()->pid(); 242 const pid_t zygote = content::ZygoteHost::GetInstance()->GetPid();
243 GetAllChildren(processes, getpid(), zygote, &current_browser_processes); 243 GetAllChildren(processes, getpid(), zygote, &current_browser_processes);
244 ProcessData current_browser; 244 ProcessData current_browser;
245 GetProcessDataMemoryInformation(current_browser_processes, &current_browser); 245 GetProcessDataMemoryInformation(current_browser_processes, &current_browser);
246 current_browser.name = WideToUTF16(chrome::kBrowserAppName); 246 current_browser.name = WideToUTF16(chrome::kBrowserAppName);
247 current_browser.process_name = ASCIIToUTF16("chrome"); 247 current_browser.process_name = ASCIIToUTF16("chrome");
248 248
249 for (std::vector<ProcessMemoryInformation>::iterator 249 for (std::vector<ProcessMemoryInformation>::iterator
250 i = current_browser.processes.begin(); 250 i = current_browser.processes.begin();
251 i != current_browser.processes.end(); ++i) { 251 i != current_browser.processes.end(); ++i) {
252 // Check if this is one of the child processes whose data we collected 252 // Check if this is one of the child processes whose data we collected
(...skipping 29 matching lines...) Expand all
282 } 282 }
283 283
284 process_data_.push_back(browser); 284 process_data_.push_back(browser);
285 } 285 }
286 286
287 // Finally return to the browser thread. 287 // Finally return to the browser thread.
288 BrowserThread::PostTask( 288 BrowserThread::PostTask(
289 BrowserThread::UI, FROM_HERE, 289 BrowserThread::UI, FROM_HERE,
290 base::Bind(&MemoryDetails::CollectChildInfoOnUIThread, this)); 290 base::Bind(&MemoryDetails::CollectChildInfoOnUIThread, this));
291 } 291 }
OLDNEW
« no previous file with comments | « chrome/browser/memory_details.cc ('k') | chrome/browser/oom_priority_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698