diff options
author | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-14 03:25:15 +0000 |
---|---|---|
committer | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-14 03:25:15 +0000 |
commit | 176aa48371da91eb98d675d87b4e70c7b26d696f (patch) | |
tree | 4c972de6ecd5a54650ab1dc7d421187f5d25834f /chrome | |
parent | 9a3f0ac2899139ace97e399015259d028b4d5704 (diff) | |
download | chromium_src-176aa48371da91eb98d675d87b4e70c7b26d696f.zip chromium_src-176aa48371da91eb98d675d87b4e70c7b26d696f.tar.gz chromium_src-176aa48371da91eb98d675d87b4e70c7b26d696f.tar.bz2 |
Add Terminate() to the Process object, have RenderProcessHost use this to avoid some more Windows specific code.
Move Process and SharedMemory into the base namespace (most changes).
Review URL: http://codereview.chromium.org/10895
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5446 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
78 files changed, 296 insertions, 299 deletions
diff --git a/chrome/app/chrome_exe_main.cc b/chrome/app/chrome_exe_main.cc index a8529e6..85a3462 100644 --- a/chrome/app/chrome_exe_main.cc +++ b/chrome/app/chrome_exe_main.cc @@ -21,7 +21,7 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prev_instance, wchar_t* command_line, int) { - process_util::EnableTerminationOnHeapCorruption(); + base::EnableTerminationOnHeapCorruption(); // The exit manager is in charge of calling the dtors of singletons. base::AtExitManager exit_manager; diff --git a/chrome/app/result_codes.h b/chrome/app/result_codes.h index 4acad55..950863e 100644 --- a/chrome/app/result_codes.h +++ b/chrome/app/result_codes.h @@ -20,9 +20,9 @@ class ResultCodes { public: enum ExitCode { - NORMAL_EXIT = process_util::PROCESS_END_NORMAL_TERMINATON, - TASKMAN_KILL = process_util::PROCESS_END_KILLED_BY_USER, - HUNG = process_util::PROCESS_END_PROCESS_WAS_HUNG, + NORMAL_EXIT = base::PROCESS_END_NORMAL_TERMINATON, + TASKMAN_KILL = base::PROCESS_END_KILLED_BY_USER, + HUNG = base::PROCESS_END_PROCESS_WAS_HUNG, INVALID_CMDLINE_URL, // An invalid command line url was given. SBOX_INIT_FAILED, // The sandbox could not be initialized. GOOGLE_UPDATE_INIT_FAILED, // The Google Update client stub init failed. diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 30a7fd1..5bbfc65 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -95,7 +95,7 @@ class ReducePluginsWorkingSetTask : public Task { for (PluginProcessHostIterator iter; !iter.Done(); ++iter) { PluginProcessHost* plugin = const_cast<PluginProcessHost*>(*iter); DCHECK(plugin->process()); - Process process(plugin->process()); + base::Process process(plugin->process()); process.ReduceWorkingSet(); } } @@ -115,14 +115,14 @@ class BrowserIdleTimer : public base::IdleTimer { // We're idle. Release browser and renderer unused pages. // Handle the Browser. - Process process(GetCurrentProcess()); + base::Process process(GetCurrentProcess()); process.ReduceWorkingSet(); // Handle the Renderer(s). RenderProcessHost::iterator renderer_iter; for (renderer_iter = RenderProcessHost::begin(); renderer_iter != - RenderProcessHost::end(); renderer_iter++) { - Process process(renderer_iter->second->process()); + RenderProcessHost::end(); renderer_iter++) { + base::Process process = renderer_iter->second->process(); process.ReduceWorkingSet(); } diff --git a/chrome/browser/browser_init.cc b/chrome/browser/browser_init.cc index ff9cb3f..4bf49f6 100644 --- a/chrome/browser/browser_init.cc +++ b/chrome/browser/browser_init.cc @@ -161,7 +161,7 @@ bool BrowserInit::MessageWindow::NotifyOtherProcess() { } // Time to take action. Kill the browser process. - process_util::KillProcess(process_id, ResultCodes::HUNG, true); + base::KillProcess(process_id, ResultCodes::HUNG, true); remote_window_ = NULL; return false; } @@ -295,7 +295,7 @@ void BrowserInit::MessageWindow::HuntForZombieChromeProcesses() { // Retrieve the list of browser processes on start. This list is then used to // detect zombie renderer process or plugin process. - class ZombieDetector : public process_util::ProcessFilter { + class ZombieDetector : public base::ProcessFilter { public: ZombieDetector() { for (HWND window = NULL;;) { @@ -337,9 +337,7 @@ void BrowserInit::MessageWindow::HuntForZombieChromeProcesses() { }; ZombieDetector zombie_detector; - process_util::KillProcesses(L"chrome.exe", - ResultCodes::HUNG, - &zombie_detector); + base::KillProcesses(L"chrome.exe", ResultCodes::HUNG, &zombie_detector); } diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index f048c7a..6aba314 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -239,7 +239,7 @@ bool CheckMachineLevelInstall() { uninstall_cmd.append(installer_util::switches::kForceUninstall); uninstall_cmd.append(L" --"); uninstall_cmd.append(installer_util::switches::kDoNotRemoveSharedItems); - process_util::LaunchApp(uninstall_cmd, false, false, NULL); + base::LaunchApp(uninstall_cmd, false, false, NULL); } return true; } @@ -374,7 +374,7 @@ int BrowserMain(CommandLine &parsed_command_line, parsed_command_line.command_line_string(); CommandLine::AppendSwitchWithValue(&new_command_line, switches::kUserDataDir, user_data_dir); - process_util::LaunchApp(new_command_line, false, false, NULL); + base::LaunchApp(new_command_line, false, false, NULL); } return ResultCodes::NORMAL_EXIT; diff --git a/chrome/browser/first_run.cc b/chrome/browser/first_run.cc index 3e82aa0..1c72024 100755 --- a/chrome/browser/first_run.cc +++ b/chrome/browser/first_run.cc @@ -206,8 +206,8 @@ bool Upgrade::IsBrowserAlreadyRunning() { bool Upgrade::RelaunchChromeBrowser(const CommandLine& command_line) { ::SetEnvironmentVariable(google_update::kEnvProductVersionKey, NULL); - return process_util::LaunchApp(command_line.command_line_string(), - false, false, NULL); + return base::LaunchApp(command_line.command_line_string(), + false, false, NULL); } bool Upgrade::SwapNewChromeExeIfPresent() { @@ -226,8 +226,8 @@ bool Upgrade::SwapNewChromeExeIfPresent() { std::wstring rename_cmd; if (key.Open(reg_root, dist->GetVersionKey().c_str(), KEY_READ) && key.ReadValue(google_update::kRegRenameCmdField, &rename_cmd)) { - ProcessHandle handle; - if (process_util::LaunchApp(rename_cmd, true, true, &handle)) { + base::ProcessHandle handle; + if (base::LaunchApp(rename_cmd, true, true, &handle)) { DWORD exit_code; ::GetExitCodeProcess(handle, &exit_code); ::CloseHandle(handle); @@ -267,7 +267,7 @@ class ImportProcessRunner : public base::ObjectWatcher::Delegate { // The constructor takes the importer process to watch and then it does a // message loop blocking wait until the process ends. This object now owns // the import_process handle. - explicit ImportProcessRunner(ProcessHandle import_process) + explicit ImportProcessRunner(base::ProcessHandle import_process) : import_process_(import_process), exit_code_(ResultCodes::NORMAL_EXIT) { watcher_.StartWatching(import_process, this); @@ -292,7 +292,7 @@ class ImportProcessRunner : public base::ObjectWatcher::Delegate { private: base::ObjectWatcher watcher_; - ProcessHandle import_process_; + base::ProcessHandle import_process_; DWORD exit_code_; }; @@ -309,7 +309,7 @@ class HungImporterMonitor : public WorkerThreadTicker::Callback { // The ctor takes the owner popup window and the process handle of the // process to kill in case the popup or its owned active popup become // unresponsive. - HungImporterMonitor(HWND owner_window, ProcessHandle import_process) + HungImporterMonitor(HWND owner_window, base::ProcessHandle import_process) : owner_window_(owner_window), import_process_(import_process), ticker_(kPollHangFrequency) { @@ -338,7 +338,7 @@ class HungImporterMonitor : public WorkerThreadTicker::Callback { } HWND owner_window_; - ProcessHandle import_process_; + base::ProcessHandle import_process_; WorkerThreadTicker ticker_; DISALLOW_EVIL_CONSTRUCTORS(HungImporterMonitor); }; @@ -418,8 +418,8 @@ bool FirstRun::ImportSettings(Profile* profile, int browser, EncodeImportParams(browser, items_to_import, parent_window)); // Time to launch the process that is going to do the import. - ProcessHandle import_process; - if (!process_util::LaunchApp(import_cmd, false, false, &import_process)) + base::ProcessHandle import_process; + if (!base::LaunchApp(import_cmd, false, false, &import_process)) return false; // Activate the importer monitor. It awakes periodically in another thread diff --git a/chrome/browser/greasemonkey_master.cc b/chrome/browser/greasemonkey_master.cc index 41a089f..bb9e1a3 100644 --- a/chrome/browser/greasemonkey_master.cc +++ b/chrome/browser/greasemonkey_master.cc @@ -49,7 +49,7 @@ class GreasemonkeyMaster::ScriptReloader // Runs on the master thread. // Notify the master that new scripts are available. - void NotifyMaster(SharedMemory* memory); + void NotifyMaster(base::SharedMemory* memory); // Runs on the File thread. // Scan the script directory for scripts, calling NotifyMaster when done. @@ -60,7 +60,7 @@ class GreasemonkeyMaster::ScriptReloader // Runs on the File thread. // Scan the script directory for scripts, returning either a new SharedMemory // or NULL on error. - SharedMemory* GetNewScripts(const FilePath& script_dir); + base::SharedMemory* GetNewScripts(const FilePath& script_dir); // A pointer back to our master. // May be NULL if DisownMaster() is called. @@ -85,7 +85,8 @@ void GreasemonkeyMaster::ScriptReloader::StartScan( script_dir)); } -void GreasemonkeyMaster::ScriptReloader::NotifyMaster(SharedMemory* memory) { +void GreasemonkeyMaster::ScriptReloader::NotifyMaster( + base::SharedMemory* memory) { if (!master_) { // The master went away, so these new scripts aren't useful anymore. delete memory; @@ -99,7 +100,7 @@ void GreasemonkeyMaster::ScriptReloader::NotifyMaster(SharedMemory* memory) { } void GreasemonkeyMaster::ScriptReloader::RunScan(const FilePath script_dir) { - SharedMemory* shared_memory = GetNewScripts(script_dir); + base::SharedMemory* shared_memory = GetNewScripts(script_dir); // Post the new scripts back to the master's message loop. master_message_loop_->PostTask(FROM_HERE, @@ -108,7 +109,7 @@ void GreasemonkeyMaster::ScriptReloader::RunScan(const FilePath script_dir) { shared_memory)); } -SharedMemory* GreasemonkeyMaster::ScriptReloader::GetNewScripts( +base::SharedMemory* GreasemonkeyMaster::ScriptReloader::GetNewScripts( const FilePath& script_dir) { std::vector<std::wstring> scripts; @@ -140,7 +141,7 @@ SharedMemory* GreasemonkeyMaster::ScriptReloader::GetNewScripts( } // Create the shared memory object. - scoped_ptr<SharedMemory> shared_memory(new SharedMemory()); + scoped_ptr<base::SharedMemory> shared_memory(new base::SharedMemory()); if (!shared_memory->Create(std::wstring(), // anonymous false, // read-only @@ -179,9 +180,9 @@ GreasemonkeyMaster::~GreasemonkeyMaster() { script_reloader_->DisownMaster(); } -void GreasemonkeyMaster::NewScriptsAvailable(SharedMemory* handle) { +void GreasemonkeyMaster::NewScriptsAvailable(base::SharedMemory* handle) { // Ensure handle is deleted or released. - scoped_ptr<SharedMemory> handle_deleter(handle); + scoped_ptr<base::SharedMemory> handle_deleter(handle); if (pending_scan_) { // While we were scanning, there were further changes. Don't bother @@ -196,7 +197,7 @@ void GreasemonkeyMaster::NewScriptsAvailable(SharedMemory* handle) { NotificationService::current()->Notify(NOTIFY_NEW_USER_SCRIPTS, NotificationService::AllSources(), - Details<SharedMemory>(handle)); + Details<base::SharedMemory>(handle)); } } diff --git a/chrome/browser/greasemonkey_master.h b/chrome/browser/greasemonkey_master.h index d46c1d6..9244b80 100644 --- a/chrome/browser/greasemonkey_master.h +++ b/chrome/browser/greasemonkey_master.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_GREASEMONKEY_MASTER_H__ -#define CHROME_BROWSER_GREASEMONKEY_MASTER_H__ +#ifndef CHROME_BROWSER_GREASEMONKEY_MASTER_H_ +#define CHROME_BROWSER_GREASEMONKEY_MASTER_H_ #include "base/directory_watcher.h" #include "base/process.h" @@ -24,12 +24,12 @@ class GreasemonkeyMaster : public base::RefCounted<GreasemonkeyMaster>, ~GreasemonkeyMaster(); // Gets the segment of shared memory for the scripts. - SharedMemory* GetSharedMemory() const { + base::SharedMemory* GetSharedMemory() const { return shared_memory_.get(); } // Called by the script reloader when new scripts have been loaded. - void NewScriptsAvailable(SharedMemory* handle); + void NewScriptsAvailable(base::SharedMemory* handle); // Return true if we have any scripts ready. bool ScriptsReady() const { return shared_memory_.get() != NULL; } @@ -59,7 +59,7 @@ class GreasemonkeyMaster : public base::RefCounted<GreasemonkeyMaster>, scoped_refptr<ScriptReloader> script_reloader_; // Contains the scripts that were found the last time scripts were updated. - scoped_ptr<SharedMemory> shared_memory_; + scoped_ptr<base::SharedMemory> shared_memory_; // If the script directory is modified while we're rescanning it, we note // that we're currently mid-scan and then start over again once the scan @@ -69,4 +69,4 @@ class GreasemonkeyMaster : public base::RefCounted<GreasemonkeyMaster>, DISALLOW_COPY_AND_ASSIGN(GreasemonkeyMaster); }; -#endif // CHROME_BROWSER_GREASEMONKEY_MASTER_H__ +#endif // CHROME_BROWSER_GREASEMONKEY_MASTER_H_ diff --git a/chrome/browser/greasemonkey_master_unittest.cc b/chrome/browser/greasemonkey_master_unittest.cc index 71676d7..17924b5 100644 --- a/chrome/browser/greasemonkey_master_unittest.cc +++ b/chrome/browser/greasemonkey_master_unittest.cc @@ -53,7 +53,7 @@ class GreasemonkeyMasterTest : public testing::Test, const NotificationDetails& details) { DCHECK(type == NOTIFY_NEW_USER_SCRIPTS); - shared_memory_ = Details<SharedMemory>(details).ptr(); + shared_memory_ = Details<base::SharedMemory>(details).ptr(); if (MessageLoop::current() == &message_loop_) MessageLoop::current()->Quit(); } @@ -65,13 +65,13 @@ class GreasemonkeyMasterTest : public testing::Test, FilePath script_dir_; // Updated to the script shared memory when we get notified. - SharedMemory* shared_memory_; + base::SharedMemory* shared_memory_; }; // Test that we *don't* get spurious notifications. TEST_F(GreasemonkeyMasterTest, NoScripts) { // Set shared_memory_ to something non-NULL, so we can check it became NULL. - shared_memory_ = reinterpret_cast<SharedMemory*>(1); + shared_memory_ = reinterpret_cast<base::SharedMemory*>(1); scoped_refptr<GreasemonkeyMaster> master( new GreasemonkeyMaster(MessageLoop::current(), script_dir_)); diff --git a/chrome/browser/memory_details.cc b/chrome/browser/memory_details.cc index afa01a8..fe58ec0 100644 --- a/chrome/browser/memory_details.cc +++ b/chrome/browser/memory_details.cc @@ -79,7 +79,7 @@ void MemoryDetails::CollectPluginInformation() { continue; PluginProcessInformation info; - info.pid = process_util::GetProcId(plugin->process()); + info.pid = base::GetProcId(plugin->process()); if (info.pid != 0) { info.dll_path = plugin->dll_path(); plugins_.push_back(info); @@ -129,9 +129,8 @@ void MemoryDetails::CollectProcessData() { // Get Memory Information. ProcessMemoryInformation info; info.pid = process_list[index]; - scoped_ptr<process_util::ProcessMetrics> metrics; - metrics.reset( - process_util::ProcessMetrics::CreateProcessMetrics(handle)); + scoped_ptr<base::ProcessMetrics> metrics; + metrics.reset(base::ProcessMetrics::CreateProcessMetrics(handle)); metrics->GetCommittedKBytes(&info.committed); metrics->GetWorkingSetKBytes(&info.working_set); diff --git a/chrome/browser/memory_details.h b/chrome/browser/memory_details.h index ddd76d1..8f0f03b 100644 --- a/chrome/browser/memory_details.h +++ b/chrome/browser/memory_details.h @@ -25,9 +25,9 @@ struct ProcessMemoryInformation { // The process id. int pid; // The working set information. - process_util::WorkingSetKBytes working_set; + base::WorkingSetKBytes working_set; // The committed bytes. - process_util::CommittedKBytes committed; + base::CommittedKBytes committed; // The process version std::wstring version; // The process product name. diff --git a/chrome/browser/metrics_service_uitest.cc b/chrome/browser/metrics_service_uitest.cc index c62642d7..db35f1c 100644 --- a/chrome/browser/metrics_service_uitest.cc +++ b/chrome/browser/metrics_service_uitest.cc @@ -91,7 +91,7 @@ TEST_F(MetricsServiceTest, CrashRenderers) { int process_id = 0; ASSERT_TRUE(tab->GetProcessID(&process_id)); ASSERT_NE(0, process_id); - process_util::KillProcess(process_id, 0xc0000005, true); // Fake Access Violation. + base::KillProcess(process_id, 0xc0000005, true); // Fake Access Violation. // Give the browser a chance to notice the crashed tab. Sleep(1000); diff --git a/chrome/browser/plugin_process_host.cc b/chrome/browser/plugin_process_host.cc index 2f84e57..0332015 100644 --- a/chrome/browser/plugin_process_host.cc +++ b/chrome/browser/plugin_process_host.cc @@ -433,7 +433,7 @@ bool PluginProcessHost::Init(const std::wstring& dll, } else { // spawn child process HANDLE process; - if (!process_util::LaunchApp(cmd_line, false, false, &process)) + if (!base::LaunchApp(cmd_line, false, false, &process)) return false; process_.set_handle(process); } @@ -470,7 +470,7 @@ void PluginProcessHost::OnObjectSignaled(HANDLE object) { DCHECK(process_.handle()); DCHECK_EQ(object, process_.handle()); - bool did_crash = process_util::DidProcessCrash(object); + bool did_crash = base::DidProcessCrash(object); if (did_crash) { // Report that this plugin crashed. diff --git a/chrome/browser/plugin_process_host.h b/chrome/browser/plugin_process_host.h index 7ae7d29..9301254 100644 --- a/chrome/browser/plugin_process_host.h +++ b/chrome/browser/plugin_process_host.h @@ -132,7 +132,7 @@ class PluginProcessHost : public IPC::Channel::Listener, std::vector<ChannelRequest> sent_requests_; // The handle to our plugin process. - Process process_; + base::Process process_; // Used to watch the plugin process handle. base::ObjectWatcher watcher_; diff --git a/chrome/browser/printing/print_view_manager.cc b/chrome/browser/printing/print_view_manager.cc index 8df4862..26ae627 100644 --- a/chrome/browser/printing/print_view_manager.cc +++ b/chrome/browser/printing/print_view_manager.cc @@ -131,7 +131,7 @@ void PrintViewManager::DidPrintPage( return; } - SharedMemory shared_buf(params.emf_data_handle, true); + base::SharedMemory shared_buf(params.emf_data_handle, true); if (!shared_buf.Map(params.data_size)) { NOTREACHED() << "couldn't map"; owner_.Stop(); diff --git a/chrome/browser/printing/printing_layout_uitest.cc b/chrome/browser/printing/printing_layout_uitest.cc index fb0bf6b5..e8ac2e2 100644 --- a/chrome/browser/printing/printing_layout_uitest.cc +++ b/chrome/browser/printing/printing_layout_uitest.cc @@ -567,7 +567,7 @@ TEST_F(PrintingLayoutTest, DISABLED_Delayed) { scoped_ptr<base::Thread> worker( new base::Thread("PrintingLayoutTest_worker")); scoped_refptr<DismissTheWindow> dismiss_task = - new DismissTheWindow(process_util::GetProcId(process())); + new DismissTheWindow(base::GetProcId(process())); // We need to start the thread to be able to set the timer. worker->Start(); worker->message_loop()->PostTask(FROM_HERE, @@ -605,7 +605,7 @@ TEST_F(PrintingLayoutTest, DISABLED_IFrame) { scoped_ptr<base::Thread> worker( new base::Thread("PrintingLayoutTest_worker")); scoped_refptr<DismissTheWindow> dismiss_task = - new DismissTheWindow(process_util::GetProcId(process())); + new DismissTheWindow(base::GetProcId(process())); // We need to start the thread to be able to set the timer. worker->Start(); worker->message_loop()->PostTask(FROM_HERE, diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc index 80d3ea3..fb3508a 100644 --- a/chrome/browser/profile.cc +++ b/chrome/browser/profile.cc @@ -652,7 +652,7 @@ Profile* ProfileImpl::GetOriginalProfile() { return this; } -static void BroadcastNewHistoryTable(SharedMemory* table_memory) { +static void BroadcastNewHistoryTable(base::SharedMemory* table_memory) { if (!table_memory) return; @@ -662,7 +662,7 @@ static void BroadcastNewHistoryTable(SharedMemory* table_memory) { if (!i->second->channel()) continue; - SharedMemoryHandle new_table; + base::SharedMemoryHandle new_table; HANDLE process = i->second->process().handle(); if (!process) { // process can be null if it's started with the --single-process flag. diff --git a/chrome/browser/render_process_host.cc b/chrome/browser/render_process_host.cc index d5bba2b..2c659bc 100644 --- a/chrome/browser/render_process_host.cc +++ b/chrome/browser/render_process_host.cc @@ -422,7 +422,7 @@ bool RenderProcessHost::Init() { } else { // spawn child process HANDLE process; - if (!process_util::LaunchApp(cmd_line, false, false, &process)) + if (!base::LaunchApp(cmd_line, false, false, &process)) return false; process_.set_handle(process); } @@ -443,14 +443,10 @@ bool RenderProcessHost::Init() { return true; } -HANDLE RenderProcessHost::GetRendererProcessHandle() { - HANDLE result = process_.handle(); - if (!result) { - // Renderer process can be null if it's started with the --single-process - // flag. - result = GetCurrentProcess(); - } - return result; +base::ProcessHandle RenderProcessHost::GetRendererProcessHandle() { + if (run_renderer_in_process_) + return base::Process::Current().handle(); + return process_.handle(); } void RenderProcessHost::InitVisitedLinks() { @@ -459,7 +455,7 @@ void RenderProcessHost::InitVisitedLinks() { return; } - SharedMemoryHandle handle_for_process = NULL; + base::SharedMemoryHandle handle_for_process = NULL; visitedlink_master->ShareToProcess(GetRendererProcessHandle(), &handle_for_process); DCHECK(handle_for_process); @@ -495,8 +491,8 @@ void RenderProcessHost::InitGreasemonkeyScripts() { } void RenderProcessHost::SendGreasemonkeyScriptsUpdate( - SharedMemory *shared_memory) { - SharedMemoryHandle handle_for_process = NULL; + base::SharedMemory *shared_memory) { + base::SharedMemoryHandle handle_for_process = NULL; shared_memory->ShareToProcess(GetRendererProcessHandle(), &handle_for_process); DCHECK(handle_for_process); @@ -536,12 +532,10 @@ void RenderProcessHost::ReportExpectingClose(int32 listener_id) { } bool RenderProcessHost::FastShutdownIfPossible() { - HANDLE proc = process().handle(); - if (!proc) - return false; - // If we're in single process mode, do nothing. + if (!process_.handle()) + return false; // Render process is probably crashed. if (RenderProcessHost::run_renderer_in_process()) - return false; + return false; // Since process mode can't do fast shutdown. // Test if there's an unload listener RenderProcessHost::listeners_iterator iter; @@ -561,9 +555,10 @@ bool RenderProcessHost::FastShutdownIfPossible() { return false; } } - // Otherwise, call TerminateProcess. Using exit code 0 means that UMA won't - // treat this as a renderer crash. - ::TerminateProcess(proc, ResultCodes::NORMAL_EXIT); + + // Otherwise, we're allowed to just terminate the process. Using exit code 0 + // means that UMA won't treat this as a renderer crash. + process_.Terminate(ResultCodes::NORMAL_EXIT); return true; } @@ -651,7 +646,7 @@ void RenderProcessHost::OnObjectSignaled(HANDLE object) { DCHECK(channel_.get()); DCHECK_EQ(object, process_.handle()); - bool clean_shutdown = !process_util::DidProcessCrash(object); + bool clean_shutdown = !base::DidProcessCrash(object); process_.Close(); @@ -824,7 +819,8 @@ void RenderProcessHost::Observe(NotificationType type, break; } case NOTIFY_NEW_USER_SCRIPTS: { - SharedMemory* shared_memory = Details<SharedMemory>(details).ptr(); + base::SharedMemory* shared_memory = + Details<base::SharedMemory>(details).ptr(); DCHECK(shared_memory); if (shared_memory) { SendGreasemonkeyScriptsUpdate(shared_memory); diff --git a/chrome/browser/render_process_host.h b/chrome/browser/render_process_host.h index 262710f..597cc2b3 100644 --- a/chrome/browser/render_process_host.h +++ b/chrome/browser/render_process_host.h @@ -102,7 +102,7 @@ class RenderProcessHost : public IPC::Channel::Listener, return channel_.get(); } - const Process& process() const { + const base::Process& process() const { return process_; } @@ -178,7 +178,7 @@ class RenderProcessHost : public IPC::Channel::Listener, // to register/unregister visibility. void WidgetRestored(); void WidgetHidden(); - + // Add a word in the spellchecker. void AddWord(const std::wstring& word); @@ -194,7 +194,7 @@ class RenderProcessHost : public IPC::Channel::Listener, // Clipboard messages void OnClipboardWriteHTML(const std::wstring& markup, const GURL& src_url); void OnClipboardWriteBookmark(const std::wstring& title, const GURL& url); - void OnClipboardWriteBitmap(SharedMemoryHandle bitmap, gfx::Size size); + void OnClipboardWriteBitmap(base::SharedMemoryHandle bitmap, gfx::Size size); void OnClipboardIsFormatAvailable(unsigned int format, bool* result); void OnClipboardReadText(std::wstring* result); void OnClipboardReadAsciiText(std::string* result); @@ -210,11 +210,11 @@ class RenderProcessHost : public IPC::Channel::Listener, void InitGreasemonkeyScripts(); // Sends the renderer process a new set of Greasemonkey scripts. - void SendGreasemonkeyScriptsUpdate(SharedMemory* shared_memory); + void SendGreasemonkeyScriptsUpdate(base::SharedMemory* shared_memory); // Gets a handle to the renderer process, normalizing the case where we were // started with --single-process. - HANDLE GetRendererProcessHandle(); + base::ProcessHandle GetRendererProcessHandle(); // Callers can reduce the RenderProcess' priority. // Returns true if the priority is backgrounded; false otherwise. @@ -237,7 +237,7 @@ class RenderProcessHost : public IPC::Channel::Listener, scoped_ptr<IPC::SyncChannel> channel_; // Our renderer process. - Process process_; + base::Process process_; // Used to watch the renderer process handle. base::ObjectWatcher watcher_; diff --git a/chrome/browser/resource_dispatcher_host.cc b/chrome/browser/resource_dispatcher_host.cc index f990a26..fdaadc3 100644 --- a/chrome/browser/resource_dispatcher_host.cc +++ b/chrome/browser/resource_dispatcher_host.cc @@ -121,7 +121,7 @@ class ResourceDispatcherHost::AsyncEventHandler read_buffer_.reset(spare_read_buffer_); spare_read_buffer_ = NULL; } else { - read_buffer_.reset(new SharedMemory); + read_buffer_.reset(new base::SharedMemory); if (!read_buffer_->Create(std::wstring(), false, false, kReadBufSize)) return false; if (!read_buffer_->Map(kReadBufSize)) @@ -142,7 +142,7 @@ class ResourceDispatcherHost::AsyncEventHandler return true; } - SharedMemoryHandle handle; + base::SharedMemoryHandle handle; if (!read_buffer_->GiveToProcess(render_process_, &handle)) { // We wrongfully incremented the pending data count. Fake an ACK message // to fix this. We can't move this call above the WillSendData because @@ -175,16 +175,18 @@ class ResourceDispatcherHost::AsyncEventHandler // When reading, we don't know if we are going to get EOF (0 bytes read), so // we typically have a buffer that we allocated but did not use. We keep // this buffer around for the next read as a small optimization. - static SharedMemory* spare_read_buffer_; + static base::SharedMemory* spare_read_buffer_; - scoped_ptr<SharedMemory> read_buffer_; + scoped_ptr<base::SharedMemory> read_buffer_; ResourceDispatcherHost::Receiver* receiver_; int render_process_host_id_; int routing_id_; HANDLE render_process_; ResourceDispatcherHost* rdh_; }; -SharedMemory* ResourceDispatcherHost::AsyncEventHandler::spare_read_buffer_; + +base::SharedMemory* + ResourceDispatcherHost::AsyncEventHandler::spare_read_buffer_; // ---------------------------------------------------------------------------- // ResourceDispatcherHost::SyncEventHandler diff --git a/chrome/browser/resource_dispatcher_host_unittest.cc b/chrome/browser/resource_dispatcher_host_unittest.cc index 72b837d..7002b41 100644 --- a/chrome/browser/resource_dispatcher_host_unittest.cc +++ b/chrome/browser/resource_dispatcher_host_unittest.cc @@ -163,13 +163,13 @@ void CheckSuccessfulRequest(const std::vector<IPC::Message>& messages, void* iter = NULL; int request_id; ASSERT_TRUE(IPC::ReadParam(&messages[1], &iter, &request_id)); - SharedMemoryHandle shm_handle; + base::SharedMemoryHandle shm_handle; ASSERT_TRUE(IPC::ReadParam(&messages[1], &iter, &shm_handle)); int data_len; ASSERT_TRUE(IPC::ReadParam(&messages[1], &iter, &data_len)); ASSERT_EQ(reference_data.size(), data_len); - SharedMemory shared_mem(shm_handle, true); // read only + base::SharedMemory shared_mem(shm_handle, true); // read only shared_mem.Map(data_len); const char* data = static_cast<char*>(shared_mem.memory()); ASSERT_EQ(0, memcmp(reference_data.c_str(), data, data_len)); diff --git a/chrome/browser/resource_message_filter.cc b/chrome/browser/resource_message_filter.cc index 24eb964..d937341 100644 --- a/chrome/browser/resource_message_filter.cc +++ b/chrome/browser/resource_message_filter.cc @@ -487,11 +487,11 @@ void ResourceMessageFilter::OnGetCPBrowsingContext(uint32* context) { } void ResourceMessageFilter::OnDuplicateSection( - SharedMemoryHandle renderer_handle, - SharedMemoryHandle* browser_handle) { + base::SharedMemoryHandle renderer_handle, + base::SharedMemoryHandle* browser_handle) { // Duplicate the handle in this process right now so the memory is kept alive // (even if it is not mapped) - SharedMemory shared_buf(renderer_handle, true, render_handle_); + base::SharedMemory shared_buf(renderer_handle, true, render_handle_); shared_buf.GiveToProcess(GetCurrentProcess(), browser_handle); } diff --git a/chrome/browser/resource_message_filter.h b/chrome/browser/resource_message_filter.h index 1b068e4..4630cdb 100644 --- a/chrome/browser/resource_message_filter.h +++ b/chrome/browser/resource_message_filter.h @@ -136,8 +136,8 @@ class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter, void OnGetPreferredExtensionForMimeType(const std::string& mime_type, std::wstring* ext); void OnGetCPBrowsingContext(uint32* context); - void OnDuplicateSection(SharedMemoryHandle renderer_handle, - SharedMemoryHandle* browser_handle); + void OnDuplicateSection(base::SharedMemoryHandle renderer_handle, + base::SharedMemoryHandle* browser_handle); void OnResourceTypeStats(const CacheManager::ResourceTypeStats& stats); // A javascript code requested to print the current page. This is done in two diff --git a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc index b4ae5ea7..41b8f9c 100644 --- a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc @@ -1006,9 +1006,9 @@ void PeformUpdate(const std::wstring& initial_db, EXPECT_TRUE(database->Init(filename, NULL)); Time before_time = Time::Now(); - ProcessHandle handle = Process::Current().handle(); - scoped_ptr<process_util::ProcessMetrics> metric( - process_util::ProcessMetrics::CreateProcessMetrics(handle)); + base::ProcessHandle handle = base::Process::Current().handle(); + scoped_ptr<base::ProcessMetrics> metric( + base::ProcessMetrics::CreateProcessMetrics(handle)); #if defined(OS_WIN) || defined(OS_LINUX) CHECK(metric->GetIOCounters(&before)); #endif diff --git a/chrome/browser/task_manager.cc b/chrome/browser/task_manager.cc index fb55942..b1994da 100644 --- a/chrome/browser/task_manager.cc +++ b/chrome/browser/task_manager.cc @@ -96,7 +96,7 @@ std::wstring TaskManagerTableModel::GetText(int row, int col_id) { ResourceList* group = group_map_[resource->GetProcess()]; DCHECK(group && !group->empty()); bool first_in_group = ((*group)[0] == resource); - process_util::ProcessMetrics* process_metrics = NULL; + base::ProcessMetrics* process_metrics = NULL; if (first_in_group) { MetricsMap::iterator iter = metrics_map_.find(resource->GetProcess()); DCHECK(iter != metrics_map_.end()); @@ -148,7 +148,7 @@ std::wstring TaskManagerTableModel::GetText(int row, int col_id) { case IDS_TASK_MANAGER_PROCESS_ID_COLUMN: if (!first_in_group) return std::wstring(); - return IntToWString(process_util::GetProcId(resource->GetProcess())); + return IntToWString(base::GetProcId(resource->GetProcess())); case kGoatsTeleportedColumn: // Goats Teleported. goats_teleported_ += rand(); @@ -175,23 +175,23 @@ int TaskManagerTableModel::GetCPUUsage(TaskManager::Resource* resource) { } size_t TaskManagerTableModel::GetPrivateMemory( - process_util::ProcessMetrics* process_metrics) { + base::ProcessMetrics* process_metrics) { return process_metrics->GetPrivateBytes() / 1024; } size_t TaskManagerTableModel::GetSharedMemory( - process_util::ProcessMetrics* process_metrics) { - process_util::WorkingSetKBytes ws_usage; + base::ProcessMetrics* process_metrics) { + base::WorkingSetKBytes ws_usage; process_metrics->GetWorkingSetKBytes(&ws_usage); return ws_usage.shared; } size_t TaskManagerTableModel::GetPhysicalMemory( - process_util::ProcessMetrics* process_metrics) { + base::ProcessMetrics* process_metrics) { // Memory = working_set.private + working_set.shareable. // We exclude the shared memory. size_t total_kbytes = process_metrics->GetWorkingSetSize() / 1024; - process_util::WorkingSetKBytes ws_usage; + base::WorkingSetKBytes ws_usage; process_metrics->GetWorkingSetKBytes(&ws_usage); total_kbytes -= ws_usage.shared; return total_kbytes; @@ -204,7 +204,7 @@ int TaskManagerTableModel::GetStatsValue(TaskManager::Resource* resource, const wchar_t* counter = table->GetRowName(col_id); if (counter != NULL && counter[0] != '\0') { return table->GetCounterValue(counter, - process_util::GetProcId(resource->GetProcess())); + base::GetProcId(resource->GetProcess())); } else { NOTREACHED() << "Invalid column."; } @@ -344,8 +344,8 @@ void TaskManagerTableModel::AddResource(TaskManager::Resource* resource) { new_entry_index = static_cast<int>(iter - resources_.begin()); resources_.insert(++iter, resource); } - process_util::ProcessMetrics* pm = - process_util::ProcessMetrics::CreateProcessMetrics(process); + base::ProcessMetrics* pm = + base::ProcessMetrics::CreateProcessMetrics(process); metrics_map_[process] = pm; // Notify the table that the contents have changed for it to redraw. @@ -503,8 +503,8 @@ int TaskManagerTableModel::CompareValues(int row1, int row2, int column_id) { GetCPUUsage(resources_[row2])); case IDS_TASK_MANAGER_PRIVATE_MEM_COLUMN: { - process_util::ProcessMetrics* pm1; - process_util::ProcessMetrics* pm2; + base::ProcessMetrics* pm1; + base::ProcessMetrics* pm2; if (!GetProcessMetricsForRows(row1, row2, &pm1, &pm2)) return 0; return ValueCompare<size_t>(GetPrivateMemory(pm1), @@ -512,8 +512,8 @@ int TaskManagerTableModel::CompareValues(int row1, int row2, int column_id) { } case IDS_TASK_MANAGER_SHARED_MEM_COLUMN: { - process_util::ProcessMetrics* pm1; - process_util::ProcessMetrics* pm2; + base::ProcessMetrics* pm1; + base::ProcessMetrics* pm2; if (!GetProcessMetricsForRows(row1, row2, &pm1, &pm2)) return 0; return ValueCompare<size_t>(GetSharedMemory(pm1), @@ -521,8 +521,8 @@ int TaskManagerTableModel::CompareValues(int row1, int row2, int column_id) { } case IDS_TASK_MANAGER_PHYSICAL_MEM_COLUMN: { - process_util::ProcessMetrics* pm1; - process_util::ProcessMetrics* pm2; + base::ProcessMetrics* pm1; + base::ProcessMetrics* pm2; if (!GetProcessMetricsForRows(row1, row2, &pm1, &pm2)) return 0; return ValueCompare<size_t>(GetPhysicalMemory(pm1), @@ -530,8 +530,8 @@ int TaskManagerTableModel::CompareValues(int row1, int row2, int column_id) { } case IDS_TASK_MANAGER_PROCESS_ID_COLUMN: { - int proc1_id = process_util::GetProcId(resources_[row1]->GetProcess()); - int proc2_id = process_util::GetProcId(resources_[row2]->GetProcess()); + int proc1_id = base::GetProcId(resources_[row1]->GetProcess()); + int proc2_id = base::GetProcId(resources_[row2]->GetProcess()); return ValueCompare<int>(proc1_id, proc2_id); } @@ -632,8 +632,8 @@ void TaskManagerTableModel::OnBytesRead(URLRequestJob* job, int byte_count) { bool TaskManagerTableModel::GetProcessMetricsForRows( int row1, int row2, - process_util::ProcessMetrics** proc_metrics1, - process_util::ProcessMetrics** proc_metrics2) { + base::ProcessMetrics** proc_metrics1, + base::ProcessMetrics** proc_metrics2) { DCHECK(row1 < static_cast<int>(resources_.size()) && row2 < static_cast<int>(resources_.size())); diff --git a/chrome/browser/task_manager.h b/chrome/browser/task_manager.h index 26fc67e..3c872fb 100644 --- a/chrome/browser/task_manager.h +++ b/chrome/browser/task_manager.h @@ -36,7 +36,7 @@ class View; class Window; } -namespace process_util { +namespace base { class ProcessMetrics; } @@ -215,7 +215,7 @@ class TaskManagerTableModel : public views::GroupTableModel, }; typedef std::map<HANDLE, std::vector<TaskManager::Resource*>*> GroupMap; - typedef std::map<HANDLE, process_util::ProcessMetrics*> MetricsMap; + typedef std::map<HANDLE, base::ProcessMetrics*> MetricsMap; typedef std::map<HANDLE, int> CPUUsageMap; typedef std::map<TaskManager::Resource*, int64> ResourceValueMap; typedef std::vector<TaskManager::Resource*> ResourceList; @@ -254,15 +254,15 @@ class TaskManagerTableModel : public views::GroupTableModel, // Retrieves the private memory (in KB) that should be displayed from the // passed |process_metrics|. - size_t GetPrivateMemory(process_util::ProcessMetrics* process_metrics); + size_t GetPrivateMemory(base::ProcessMetrics* process_metrics); // Returns the shared memory (in KB) that should be displayed from the passed // |process_metrics|. - size_t GetSharedMemory(process_util::ProcessMetrics* process_metrics); + size_t GetSharedMemory(base::ProcessMetrics* process_metrics); // Returns the pysical memory (in KB) that should be displayed from the passed // |process_metrics|. - size_t GetPhysicalMemory(process_util::ProcessMetrics* process_metrics); + size_t GetPhysicalMemory(base::ProcessMetrics* process_metrics); // Returns the stat value at the column |col_id| that should be displayed from // the passed |process_metrics|. @@ -272,8 +272,8 @@ class TaskManagerTableModel : public views::GroupTableModel, // Returns true if there was a ProcessMetrics available for both rows. bool GetProcessMetricsForRows(int row1, int row2, - process_util::ProcessMetrics** proc_metrics1, - process_util::ProcessMetrics** proc_metrics2); + base::ProcessMetrics** proc_metrics1, + base::ProcessMetrics** proc_metrics2); // The list of providers to the task manager. They are ref counted. ResourceProviderList providers_; diff --git a/chrome/browser/task_manager_resource_providers.cc b/chrome/browser/task_manager_resource_providers.cc index 45c51eb..ceca70c 100644 --- a/chrome/browser/task_manager_resource_providers.cc +++ b/chrome/browser/task_manager_resource_providers.cc @@ -34,7 +34,7 @@ TaskManagerWebContentsResource::TaskManagerWebContentsResource( // We cache the process as when the WebContents is closed the process // becomes NULL and the TaskManager still needs it. process_ = web_contents_->process()->process().handle(); - pid_ = process_util::GetProcId(process_); + pid_ = base::GetProcId(process_); } TaskManagerWebContentsResource::~TaskManagerWebContentsResource() { @@ -236,7 +236,7 @@ TaskManagerPluginProcessResource::TaskManagerPluginProcessResource( : plugin_process_(plugin_proc), title_(), network_usage_support_(false) { - pid_ = process_util::GetProcId(plugin_proc.process()); + pid_ = base::GetProcId(plugin_proc.process()); if (!default_icon_) { ResourceBundle& rb = ResourceBundle::GetSharedInstance(); default_icon_ = rb.GetBitmapNamed(IDR_PLUGIN); @@ -399,7 +399,7 @@ void TaskManagerPluginProcessResourceProvider::AddToTaskManager( TaskManagerPluginProcessResource* resource = new TaskManagerPluginProcessResource(plugin_process_info); resources_[plugin_process_info] = resource; - pid_to_resources_[process_util::GetProcId(plugin_process_info.process())] = + pid_to_resources_[base::GetProcId(plugin_process_info.process())] = resource; task_manager_->AddResource(resource); } diff --git a/chrome/browser/visitedlink_master.cc b/chrome/browser/visitedlink_master.cc index ae63204..ed2c1f4 100644 --- a/chrome/browser/visitedlink_master.cc +++ b/chrome/browser/visitedlink_master.cc @@ -258,8 +258,8 @@ bool VisitedLinkMaster::Init() { return true; } -bool VisitedLinkMaster::ShareToProcess(ProcessHandle process, - SharedMemoryHandle *new_handle) { +bool VisitedLinkMaster::ShareToProcess(base::ProcessHandle process, + base::SharedMemoryHandle *new_handle) { if (shared_memory_) return shared_memory_->ShareToProcess(process, new_handle); @@ -267,7 +267,7 @@ bool VisitedLinkMaster::ShareToProcess(ProcessHandle process, return false; } -SharedMemoryHandle VisitedLinkMaster::GetSharedMemoryHandle() { +base::SharedMemoryHandle VisitedLinkMaster::GetSharedMemoryHandle() { return shared_memory_->handle(); } @@ -674,7 +674,7 @@ bool VisitedLinkMaster::CreateURLTable(int32 num_entries, bool init_to_empty) { int32 alloc_size = num_entries * sizeof(Fingerprint) + sizeof(SharedHeader); // Create the shared memory object. - shared_memory_ = new SharedMemory(); + shared_memory_ = new base::SharedMemory(); if (!shared_memory_) return false; @@ -712,7 +712,7 @@ bool VisitedLinkMaster::CreateURLTable(int32 num_entries, bool init_to_empty) { } bool VisitedLinkMaster::BeginReplaceURLTable(int32 num_entries) { - SharedMemory *old_shared_memory = shared_memory_; + base::SharedMemory *old_shared_memory = shared_memory_; Fingerprint* old_hash_table = hash_table_; int32 old_table_length = table_length_; if (!CreateURLTable(num_entries, true)) { @@ -771,7 +771,7 @@ void VisitedLinkMaster::ResizeTable(int32 new_size) { DebugValidate(); #endif - SharedMemory* old_shared_memory = shared_memory_; + base::SharedMemory* old_shared_memory = shared_memory_; Fingerprint* old_hash_table = hash_table_; int32 old_table_length = table_length_; if (!BeginReplaceURLTable(new_size)) @@ -870,7 +870,7 @@ void VisitedLinkMaster::OnTableRebuildComplete( // We are responsible for freeing it AFTER it has been replaced if // replacement succeeds. - SharedMemory* old_shared_memory = shared_memory_; + base::SharedMemory* old_shared_memory = shared_memory_; int new_table_size = NewTableSizeForCount( static_cast<int>(fingerprints.size())); diff --git a/chrome/browser/visitedlink_master.h b/chrome/browser/visitedlink_master.h index 56923a7..8c0af4b 100644 --- a/chrome/browser/visitedlink_master.h +++ b/chrome/browser/visitedlink_master.h @@ -27,7 +27,7 @@ class Profile; // operations are pending on another thread. class VisitedLinkMaster : public VisitedLinkCommon { public: - typedef void (PostNewTableEvent)(SharedMemory*); + typedef void (PostNewTableEvent)(base::SharedMemory*); // The |file_thread| may be NULL, in which case write operations will be // synchronous. @@ -65,14 +65,15 @@ class VisitedLinkMaster : public VisitedLinkCommon { // Duplicates the handle to the shared memory to another process. // Returns true on success. - bool ShareToProcess(ProcessHandle process, SharedMemoryHandle *new_handle); + bool ShareToProcess(base::ProcessHandle process, + base::SharedMemoryHandle *new_handle); // returns the name of the shared memory object that slaves can use to map // the data std::wstring GetSharedMemoryName() const; // Returns the handle to the shared memory - SharedMemoryHandle GetSharedMemoryHandle(); + base::SharedMemoryHandle GetSharedMemoryHandle(); // Adds a URL to the table. void AddURL(const GURL& url); @@ -329,7 +330,7 @@ class VisitedLinkMaster : public VisitedLinkCommon { HANDLE file_; // Shared memory consists of a SharedHeader followed by the table. - SharedMemory *shared_memory_; + base::SharedMemory *shared_memory_; // When we generate new tables, we increment the serial number of the // shared memory object. diff --git a/chrome/browser/visitedlink_perftest.cc b/chrome/browser/visitedlink_perftest.cc index 0f02a5a..38fe56d 100644 --- a/chrome/browser/visitedlink_perftest.cc +++ b/chrome/browser/visitedlink_perftest.cc @@ -31,7 +31,7 @@ GURL TestURL(const char* prefix, int i) { // we have no slaves, so this broadcase is a NOP VisitedLinkMaster::PostNewTableEvent DummyBroadcastNewTableEvent; -void DummyBroadcastNewTableEvent(SharedMemory *table) { +void DummyBroadcastNewTableEvent(base::SharedMemory *table) { } // Call at the beginning of the test to retrieve the database name and to diff --git a/chrome/browser/visitedlink_unittest.cc b/chrome/browser/visitedlink_unittest.cc index 7f082b7..86c2a24 100644 --- a/chrome/browser/visitedlink_unittest.cc +++ b/chrome/browser/visitedlink_unittest.cc @@ -33,11 +33,11 @@ VisitedLinkMaster* g_master = NULL; std::vector<VisitedLinkSlave*> g_slaves; VisitedLinkMaster::PostNewTableEvent SynchronousBroadcastNewTableEvent; -void SynchronousBroadcastNewTableEvent(SharedMemory* table) { +void SynchronousBroadcastNewTableEvent(base::SharedMemory* table) { if (table) { for (std::vector<VisitedLinkSlave>::size_type i = 0; i < (int)g_slaves.size(); i++) { - SharedMemoryHandle new_handle = NULL; + base::SharedMemoryHandle new_handle = NULL; table->ShareToProcess(GetCurrentProcess(), &new_handle); g_slaves[i]->Init(new_handle); } @@ -102,7 +102,7 @@ class VisitedLinkTest : public testing::Test { // Create a slave database. VisitedLinkSlave slave; - SharedMemoryHandle new_handle = NULL; + base::SharedMemoryHandle new_handle = NULL; master_->ShareToProcess(GetCurrentProcess(), &new_handle); bool success = slave.Init(new_handle); ASSERT_TRUE(success); @@ -239,7 +239,7 @@ TEST_F(VisitedLinkTest, DeleteAll) { { VisitedLinkSlave slave; - SharedMemoryHandle new_handle = NULL; + base::SharedMemoryHandle new_handle = NULL; master_->ShareToProcess(GetCurrentProcess(), &new_handle); ASSERT_TRUE(slave.Init(new_handle)); g_slaves.push_back(&slave); @@ -287,7 +287,7 @@ TEST_F(VisitedLinkTest, Resizing) { // ...and a slave VisitedLinkSlave slave; - SharedMemoryHandle new_handle = NULL; + base::SharedMemoryHandle new_handle = NULL; master_->ShareToProcess(GetCurrentProcess(), &new_handle); bool success = slave.Init(new_handle); ASSERT_TRUE(success); diff --git a/chrome/browser/web_contents.cc b/chrome/browser/web_contents.cc index 2f2fd39..dda65e1 100644 --- a/chrome/browser/web_contents.cc +++ b/chrome/browser/web_contents.cc @@ -866,8 +866,8 @@ void WebContents::DidStopLoading(RenderViewHost* rvh, int32 page_id) { if (controller()) { NavigationEntry* entry = controller()->GetActiveEntry(); if (entry) { - scoped_ptr<process_util::ProcessMetrics> metrics( - process_util::ProcessMetrics::CreateProcessMetrics( + scoped_ptr<base::ProcessMetrics> metrics( + base::ProcessMetrics::CreateProcessMetrics( process()->process().handle())); TimeDelta elapsed = TimeTicks::Now() - current_load_start_; diff --git a/chrome/common/chrome_process_filter.h b/chrome/common/chrome_process_filter.h index 513e687..b082d91 100644 --- a/chrome/common/chrome_process_filter.h +++ b/chrome/common/chrome_process_filter.h @@ -9,7 +9,7 @@ // Filter all chrome browser processes that run with the same user data // directory. -class BrowserProcessFilter : public process_util::ProcessFilter { +class BrowserProcessFilter : public base::ProcessFilter { public: // Create the filter for the given user_data_dir. // If user_data_dir is an empty string, will use the PathService diff --git a/chrome/common/ipc_tests.cc b/chrome/common/ipc_tests.cc index 3b73de9..251e970 100644 --- a/chrome/common/ipc_tests.cc +++ b/chrome/common/ipc_tests.cc @@ -377,14 +377,14 @@ HANDLE SpawnChild(ChildType child_type) { CommandLine::AppendSwitch(&cl, switches::kDebugOnStart); } HANDLE process = NULL; - if (!process_util::LaunchApp(cl, false, true, &process)) + if (!base::LaunchApp(cl, false, true, &process)) return NULL; return process; } int main(int argc, char** argv) { - process_util::EnableTerminationOnHeapCorruption(); + base::EnableTerminationOnHeapCorruption(); // Some tests may use base::Singleton<>, thus we need to instanciate // the AtExitManager or else we will leak objects. base::AtExitManager at_exit_manager; diff --git a/chrome/common/plugin_messages_internal.h b/chrome/common/plugin_messages_internal.h index f2676fd..0c009a5 100644 --- a/chrome/common/plugin_messages_internal.h +++ b/chrome/common/plugin_messages_internal.h @@ -129,8 +129,8 @@ IPC_BEGIN_MESSAGES(Plugin, 5) gfx::Rect /* clip_rect */, std::vector<gfx::Rect> /* cutout_rects */, bool /* visible */, - SharedMemoryHandle /* windowless_buffer */, - SharedMemoryHandle /* background_buffer */) + base::SharedMemoryHandle /* windowless_buffer */, + base::SharedMemoryHandle /* background_buffer */) IPC_SYNC_MESSAGE_ROUTED0_0(PluginMsg_SetFocus) diff --git a/chrome/common/process_watcher.cc b/chrome/common/process_watcher.cc index c189c2d..b43e2db 100644 --- a/chrome/common/process_watcher.cc +++ b/chrome/common/process_watcher.cc @@ -17,7 +17,7 @@ namespace { class TimerExpiredTask : public Task, public base::ObjectWatcher::Delegate { public: - explicit TimerExpiredTask(ProcessHandle process) : process_(process) { + explicit TimerExpiredTask(base::ProcessHandle process) : process_(process) { watcher_.StartWatching(process_, this); } @@ -68,7 +68,7 @@ class TimerExpiredTask : public Task, public base::ObjectWatcher::Delegate { } // The process that we are watching. - ProcessHandle process_; + base::ProcessHandle process_; base::ObjectWatcher watcher_; @@ -78,7 +78,7 @@ class TimerExpiredTask : public Task, public base::ObjectWatcher::Delegate { } // namespace // static -void ProcessWatcher::EnsureProcessTerminated(ProcessHandle process) { +void ProcessWatcher::EnsureProcessTerminated(base::ProcessHandle process) { DCHECK(process != GetCurrentProcess()); // If already signaled, then we are done! diff --git a/chrome/common/process_watcher.h b/chrome/common/process_watcher.h index caf1c9c..0f6cb6b 100644 --- a/chrome/common/process_watcher.h +++ b/chrome/common/process_watcher.h @@ -2,9 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_COMMON_PROCESS_WATCHER_H__ -#define CHROME_COMMON_PROCESS_WATCHER_H__ +#ifndef CHROME_COMMON_PROCESS_WATCHER_H_ +#define CHROME_COMMON_PROCESS_WATCHER_H_ +#include "base/basictypes.h" #include "base/process_util.h" class ProcessWatcher { @@ -22,14 +23,14 @@ class ProcessWatcher { // NOTE: The process handle must have been opened with the PROCESS_TERMINATE // and SYNCHRONIZE permissions. // - static void EnsureProcessTerminated(ProcessHandle process_handle); + static void EnsureProcessTerminated(base::ProcessHandle process_handle); private: // Do not instantiate this class. ProcessWatcher(); - DISALLOW_EVIL_CONSTRUCTORS(ProcessWatcher); + DISALLOW_COPY_AND_ASSIGN(ProcessWatcher); }; -#endif // CHROME_COMMON_PROCESS_WATCHER_H__ +#endif // CHROME_COMMON_PROCESS_WATCHER_H_ diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index d50faa6..7c6f2c1 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -189,7 +189,7 @@ struct ViewHostMsg_PaintRect_Flags { struct ViewHostMsg_PaintRect_Params { // The bitmap to be painted into the rect given by bitmap_rect. Valid only // in the context of the renderer process. - SharedMemoryHandle bitmap; + base::SharedMemoryHandle bitmap; // The position and size of the bitmap. gfx::Rect bitmap_rect; @@ -223,7 +223,7 @@ struct ViewHostMsg_PaintRect_Params { struct ViewHostMsg_ScrollRect_Params { // The bitmap to be painted into the rect exposed by scrolling. This handle // is valid only in the context of the renderer process. - SharedMemoryHandle bitmap; + base::SharedMemoryHandle bitmap; // The position and size of the bitmap. gfx::Rect bitmap_rect; @@ -367,7 +367,7 @@ struct ViewMsg_PrintPages_Params { struct ViewHostMsg_DidPrintPage_Params { // A shared memory handle to the EMF data. This data can be quite large so a // memory map needs to be used. - SharedMemoryHandle emf_data_handle; + base::SharedMemoryHandle emf_data_handle; // Size of the EMF data. unsigned data_size; diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index a4098a0..02e910d 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -156,12 +156,12 @@ IPC_BEGIN_MESSAGES(View, 1) // History system notification that the visited link database has been // replaced. It has one SharedMemoryHandle argument consisting of the table // handle. This handle is valid in the context of the renderer - IPC_MESSAGE_CONTROL1(ViewMsg_VisitedLink_NewTable, SharedMemoryHandle) + IPC_MESSAGE_CONTROL1(ViewMsg_VisitedLink_NewTable, base::SharedMemoryHandle) // Notification that the Greasemonkey scripts have been updated. It has one // SharedMemoryHandle argument consisting of the pickled script data. This // handle is valid in the context of the renderer. - IPC_MESSAGE_CONTROL1(ViewMsg_Greasemonkey_NewScripts, SharedMemoryHandle) + IPC_MESSAGE_CONTROL1(ViewMsg_Greasemonkey_NewScripts, base::SharedMemoryHandle) // Sent when the user wants to search for a word on the page (find in page). // Request parameters are passed in as a FindInPageMsg_Request struct. @@ -187,7 +187,7 @@ IPC_BEGIN_MESSAGES(View, 1) // already be mapped into the process that receives this message. IPC_MESSAGE_ROUTED3(ViewMsg_Resource_DataReceived, int /* request_id */, - SharedMemoryHandle /* data */, + base::SharedMemoryHandle /* data */, int /* data_len */) // Sent when the request has been completed. @@ -1056,8 +1056,8 @@ IPC_BEGIN_MESSAGES(ViewHost, 2) // Duplicates a shared memory handle from the renderer to the browser. Then // the renderer can flush the handle. IPC_SYNC_MESSAGE_ROUTED1_1(ViewHostMsg_DuplicateSection, - SharedMemoryHandle /* renderer handle */, - SharedMemoryHandle /* browser handle */) + base::SharedMemoryHandle /* renderer handle */, + base::SharedMemoryHandle /* browser handle */) // Provide the browser process with information about the WebCore resource // cache. diff --git a/chrome/common/resource_dispatcher.cc b/chrome/common/resource_dispatcher.cc index 04693ab..d662fd9 100644 --- a/chrome/common/resource_dispatcher.cc +++ b/chrome/common/resource_dispatcher.cc @@ -334,7 +334,7 @@ void ResourceDispatcher::OnReceivedResponse( } void ResourceDispatcher::OnReceivedData(int request_id, - SharedMemoryHandle shm_handle, + base::SharedMemoryHandle shm_handle, int data_len) { // Acknowlegde the reception of this data. IPC::Message::Sender* sender = message_sender(); @@ -343,7 +343,7 @@ void ResourceDispatcher::OnReceivedData(int request_id, new ViewHostMsg_DataReceived_ACK(MSG_ROUTING_NONE, request_id)); DCHECK((shm_handle && data_len > 0) || (!shm_handle && !data_len)); - SharedMemory shared_mem(shm_handle, true); // read only + base::SharedMemory shared_mem(shm_handle, true); // read only PendingRequestList::iterator it = pending_requests_.find(request_id); if (it == pending_requests_.end()) { diff --git a/chrome/common/resource_dispatcher.h b/chrome/common/resource_dispatcher.h index b4c4037..5fa4bc5 100644 --- a/chrome/common/resource_dispatcher.h +++ b/chrome/common/resource_dispatcher.h @@ -101,7 +101,8 @@ class ResourceDispatcher : public base::RefCounted<ResourceDispatcher> { void OnUploadProgress(int request_id, int64 position, int64 size); void OnReceivedResponse(int request_id, const ViewMsg_Resource_ResponseHead&); void OnReceivedRedirect(int request_id, const GURL& new_url); - void OnReceivedData(int request_id, SharedMemoryHandle data, int data_len); + void OnReceivedData(int request_id, base::SharedMemoryHandle data, + int data_len); void OnRequestComplete(int request_id, const URLRequestStatus& status); // Dispatch the message to one of the message response handlers. diff --git a/chrome/common/resource_dispatcher_unittest.cc b/chrome/common/resource_dispatcher_unittest.cc index a75e556..5fefdcd 100644 --- a/chrome/common/resource_dispatcher_unittest.cc +++ b/chrome/common/resource_dispatcher_unittest.cc @@ -102,13 +102,13 @@ class ResourceDispatcherTest : public testing::Test, dispatcher_->OnReceivedResponse(request_id, response); // received data message with the test contents - SharedMemory shared_mem; + base::SharedMemory shared_mem; EXPECT_TRUE(shared_mem.Create(std::wstring(), false, false, test_page_contents_len)); EXPECT_TRUE(shared_mem.Map(test_page_contents_len)); char* put_data_here = static_cast<char*>(shared_mem.memory()); memcpy(put_data_here, test_page_contents, test_page_contents_len); - SharedMemoryHandle dup_handle; + base::SharedMemoryHandle dup_handle; EXPECT_TRUE(shared_mem.GiveToProcess(GetCurrentProcess(), &dup_handle)); dispatcher_->OnReceivedData(request_id, dup_handle, test_page_contents_len); diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc index fe62e67..4bf5856 100644 --- a/chrome/installer/setup/uninstall.cc +++ b/chrome/installer/setup/uninstall.cc @@ -52,8 +52,8 @@ void CloseAllChromeProcesses() { window = FindWindowEx(NULL, window, wnd_class.c_str(), NULL); if (!SendMessageTimeout(tmpWnd, WM_CLOSE, 0, 0, SMTO_BLOCK, 3000, NULL) && (GetLastError() == ERROR_TIMEOUT)) { - process_util::CleanupProcesses(installer_util::kChromeExe, 0, - ResultCodes::HUNG, NULL); + base::CleanupProcesses(installer_util::kChromeExe, 0, + ResultCodes::HUNG, NULL); return; } } @@ -61,8 +61,8 @@ void CloseAllChromeProcesses() { // If asking politely didn't work, wait for 15 seconds and then kill all // chrome.exe. This check is just in case Chrome is ignoring WM_CLOSE messages. - process_util::CleanupProcesses(installer_util::kChromeExe, 15000, - ResultCodes::HUNG, NULL); + base::CleanupProcesses(installer_util::kChromeExe, 15000, + ResultCodes::HUNG, NULL); } // This method deletes Chrome shortcut folder from Windows Start menu. It diff --git a/chrome/installer/util/helper.cc b/chrome/installer/util/helper.cc index 3d86c8d..b7dd3c6 100644 --- a/chrome/installer/util/helper.cc +++ b/chrome/installer/util/helper.cc @@ -39,7 +39,7 @@ bool installer::LaunchChrome(bool system_install) { chrome_exe.append(installer::GetChromeInstallPath(system_install)); file_util::AppendToPath(&chrome_exe, installer_util::kChromeExe); chrome_exe.append(L"\""); - return process_util::LaunchApp(chrome_exe, false, false, NULL); + return base::LaunchApp(chrome_exe, false, false, NULL); } bool installer::LaunchChromeAndWaitForResult(bool system_install, diff --git a/chrome/installer/util/run_all_unittests.cc b/chrome/installer/util/run_all_unittests.cc index 4ab019a..e7c7b37 100644 --- a/chrome/installer/util/run_all_unittests.cc +++ b/chrome/installer/util/run_all_unittests.cc @@ -6,6 +6,6 @@ #include "base/test_suite.h" int main(int argc, char** argv) { - process_util::EnableTerminationOnHeapCorruption(); + base::EnableTerminationOnHeapCorruption(); return TestSuite(argc, argv).Run(); } diff --git a/chrome/plugin/webplugin_delegate_stub.cc b/chrome/plugin/webplugin_delegate_stub.cc index 158dc45..91df155 100644 --- a/chrome/plugin/webplugin_delegate_stub.cc +++ b/chrome/plugin/webplugin_delegate_stub.cc @@ -226,7 +226,7 @@ void WebPluginDelegateStub::OnPrint(PluginMsg_PrintResponse_Params* params) { size_t size = emf.GetDataSize(); DCHECK(size); params->size = size; - SharedMemory shared_buf; + base::SharedMemory shared_buf; CreateSharedBuffer(size, &shared_buf, ¶ms->shared_memory); // Retrieve a copy of the data. @@ -239,8 +239,8 @@ void WebPluginDelegateStub::OnUpdateGeometry( const gfx::Rect& clip_rect, const std::vector<gfx::Rect>& cutout_rects, bool visible, - const SharedMemoryHandle& windowless_buffer, - const SharedMemoryHandle& background_buffer) { + const base::SharedMemoryHandle& windowless_buffer, + const base::SharedMemoryHandle& background_buffer) { webplugin_->UpdateGeometry( window_rect, clip_rect, cutout_rects, visible, windowless_buffer, background_buffer); @@ -301,8 +301,8 @@ void WebPluginDelegateStub::OnInstallMissingPlugin() { void WebPluginDelegateStub::CreateSharedBuffer( size_t size, - SharedMemory* shared_buf, - SharedMemoryHandle* remote_handle) { + base::SharedMemory* shared_buf, + base::SharedMemoryHandle* remote_handle) { if (!shared_buf->Create(std::wstring(), false, false, size)) { NOTREACHED(); return; @@ -319,6 +319,7 @@ void WebPluginDelegateStub::CreateSharedBuffer( remote_handle, 0, FALSE, DUPLICATE_SAME_ACCESS); DCHECK_NE(result, 0); + // If the calling function's shared_buf is on the stack, its destructor will // close the shared memory buffer handle. This is fine since we already // duplicated the handle to the renderer process so it will stay "alive". diff --git a/chrome/plugin/webplugin_delegate_stub.h b/chrome/plugin/webplugin_delegate_stub.h index d8fed1f..8b49991 100644 --- a/chrome/plugin/webplugin_delegate_stub.h +++ b/chrome/plugin/webplugin_delegate_stub.h @@ -67,8 +67,8 @@ class WebPluginDelegateStub : public IPC::Channel::Listener, const gfx::Rect& clip_rect, const std::vector<gfx::Rect>& cutout_rects, bool visible, - const SharedMemoryHandle& windowless_buffer, - const SharedMemoryHandle& background_buffer); + const base::SharedMemoryHandle& windowless_buffer, + const base::SharedMemoryHandle& background_buffer); void OnGetPluginScriptableObject(int* route_id, void** npobject_ptr); void OnSendJavaScriptStream(const std::string& url, const std::wstring& result, @@ -90,8 +90,8 @@ class WebPluginDelegateStub : public IPC::Channel::Listener, HANDLE notify_data); void CreateSharedBuffer(size_t size, - SharedMemory* shared_buf, - SharedMemoryHandle* remote_handle); + base::SharedMemory* shared_buf, + base::SharedMemoryHandle* remote_handle); int instance_id_; std::string mime_type_; diff --git a/chrome/plugin/webplugin_proxy.cc b/chrome/plugin/webplugin_proxy.cc index 56beb25c..2cbb3ee 100644 --- a/chrome/plugin/webplugin_proxy.cc +++ b/chrome/plugin/webplugin_proxy.cc @@ -279,9 +279,9 @@ void WebPluginProxy::UpdateGeometry( const gfx::Rect& clip_rect, const std::vector<gfx::Rect>& cutout_rects, bool visible, - const SharedMemoryHandle& windowless_buffer, - const SharedMemoryHandle& background_buffer) { - gfx::Rect old = delegate_->rect(); + const base::SharedMemoryHandle& windowless_buffer, + const base::SharedMemoryHandle& background_buffer) { + gfx::Rect old = delegate_->rect(); bool moved = delegate_->rect().x() != window_rect.x() || delegate_->rect().y() != window_rect.y(); delegate_->UpdateGeometry(window_rect, clip_rect, cutout_rects, visible); @@ -295,8 +295,8 @@ void WebPluginProxy::UpdateGeometry( } void WebPluginProxy::SetWindowlessBuffer( - const SharedMemoryHandle& windowless_buffer, - const SharedMemoryHandle& background_buffer) { + const base::SharedMemoryHandle& windowless_buffer, + const base::SharedMemoryHandle& background_buffer) { // Convert the shared memory handle to a handle that works in our process, // and then use that to create an HDC. ConvertBuffer(windowless_buffer, @@ -312,7 +312,7 @@ void WebPluginProxy::SetWindowlessBuffer( UpdateTransform(); } -void WebPluginProxy::ConvertBuffer(const SharedMemoryHandle& buffer, +void WebPluginProxy::ConvertBuffer(const base::SharedMemoryHandle& buffer, ScopedHandle* shared_section, ScopedBitmap* bitmap, ScopedHDC* hdc) { diff --git a/chrome/plugin/webplugin_proxy.h b/chrome/plugin/webplugin_proxy.h index 5374d1c..e6a231d 100644 --- a/chrome/plugin/webplugin_proxy.h +++ b/chrome/plugin/webplugin_proxy.h @@ -83,8 +83,8 @@ class WebPluginProxy : public WebPlugin { const gfx::Rect& clip_rect, const std::vector<gfx::Rect>& cutout_rects, bool visible, - const SharedMemoryHandle& windowless_buffer, - const SharedMemoryHandle& background_buffer); + const base::SharedMemoryHandle& windowless_buffer, + const base::SharedMemoryHandle& background_buffer); void CancelDocumentLoad(); @@ -98,12 +98,12 @@ class WebPluginProxy : public WebPlugin { bool Send(IPC::Message* msg); // Updates the shared memory section where windowless plugins paint. - void SetWindowlessBuffer(const SharedMemoryHandle& windowless_buffer, - const SharedMemoryHandle& background_buffer); + void SetWindowlessBuffer(const base::SharedMemoryHandle& windowless_buffer, + const base::SharedMemoryHandle& background_buffer); // Converts a shared memory section handle from the renderer process into a // bitmap and hdc that are mapped to this process. - void ConvertBuffer(const SharedMemoryHandle& buffer, + void ConvertBuffer(const base::SharedMemoryHandle& buffer, ScopedHandle* shared_section, ScopedBitmap* bitmap, ScopedHDC* hdc); diff --git a/chrome/renderer/greasemonkey_slave.cc b/chrome/renderer/greasemonkey_slave.cc index 5a4072a..f2de9fb 100644 --- a/chrome/renderer/greasemonkey_slave.cc +++ b/chrome/renderer/greasemonkey_slave.cc @@ -113,11 +113,11 @@ std::string GreasemonkeyScript::EscapeGlob(const std::string& input_pattern) { GreasemonkeySlave::GreasemonkeySlave() : shared_memory_(NULL) { } -bool GreasemonkeySlave::UpdateScripts(SharedMemoryHandle shared_memory) { +bool GreasemonkeySlave::UpdateScripts(base::SharedMemoryHandle shared_memory) { scripts_.clear(); - // Create the shared memory object. - shared_memory_.reset(new SharedMemory(shared_memory, true)); // read-only + // Create the shared memory object (read only). + shared_memory_.reset(new base::SharedMemory(shared_memory, true)); if (!shared_memory_.get()) return false; diff --git a/chrome/renderer/greasemonkey_slave.h b/chrome/renderer/greasemonkey_slave.h index 5be3697..5f80f8b 100644 --- a/chrome/renderer/greasemonkey_slave.h +++ b/chrome/renderer/greasemonkey_slave.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_RENDERER_GREASEMONKEY_SLAVE_H__ -#define CHROME_RENDERER_GREASEMONKEY_SLAVE_H__ +#ifndef CHROME_RENDERER_GREASEMONKEY_SLAVE_H_ +#define CHROME_RENDERER_GREASEMONKEY_SLAVE_H_ #include "base/scoped_ptr.h" #include "base/shared_memory.h" @@ -75,7 +75,7 @@ class GreasemonkeySlave { GreasemonkeySlave(); // Update the parsed scripts from shared memory. - bool UpdateScripts(SharedMemoryHandle shared_memory); + bool UpdateScripts(base::SharedMemoryHandle shared_memory); // Inject the appropriate scripts into a frame based on its URL. // TODO(aa): Extract a GreasemonkeyFrame interface out of this to improve @@ -84,7 +84,7 @@ class GreasemonkeySlave { private: // Shared memory containing raw script data. - scoped_ptr<SharedMemory> shared_memory_; + scoped_ptr<base::SharedMemory> shared_memory_; // Parsed script data. std::vector<GreasemonkeyScript> scripts_; @@ -92,4 +92,4 @@ class GreasemonkeySlave { DISALLOW_COPY_AND_ASSIGN(GreasemonkeySlave); }; -#endif // CHROME_RENDERER_GREASEMONKEY_SLAVE_H__ +#endif // CHROME_RENDERER_GREASEMONKEY_SLAVE_H_ diff --git a/chrome/renderer/greasemonkey_slave_unittest.cc b/chrome/renderer/greasemonkey_slave_unittest.cc index 06c48c2..bedbfbf 100644 --- a/chrome/renderer/greasemonkey_slave_unittest.cc +++ b/chrome/renderer/greasemonkey_slave_unittest.cc @@ -7,9 +7,6 @@ #include "googleurl/src/gurl.h"
#include "testing/gtest/include/gtest/gtest.h"
-class GreasemonkeySlaveTest : public testing::Test {
-};
-
TEST(GreasemonkeySlaveTest, EscapeGlob) {
EXPECT_EQ("", GreasemonkeyScript::EscapeGlob(""));
EXPECT_EQ("*", GreasemonkeyScript::EscapeGlob("*"));
diff --git a/chrome/renderer/render_process.cc b/chrome/renderer/render_process.cc index 44a8055..b2b4606 100644 --- a/chrome/renderer/render_process.cc +++ b/chrome/renderer/render_process.cc @@ -108,10 +108,10 @@ bool RenderProcess::ShouldLoadPluginsInProcess() { } // static -SharedMemory* RenderProcess::AllocSharedMemory(size_t size) { +base::SharedMemory* RenderProcess::AllocSharedMemory(size_t size) { self()->clearer_factory_.RevokeAll(); - SharedMemory* mem = self()->GetSharedMemFromCache(size); + base::SharedMemory* mem = self()->GetSharedMemFromCache(size); if (mem) return mem; @@ -122,7 +122,7 @@ SharedMemory* RenderProcess::AllocSharedMemory(size_t size) { size = size / info.dwAllocationGranularity + 1; size = size * info.dwAllocationGranularity; - mem = new SharedMemory(); + mem = new base::SharedMemory(); if (!mem) return NULL; if (!mem->Create(L"", false, true, size)) { @@ -134,7 +134,7 @@ SharedMemory* RenderProcess::AllocSharedMemory(size_t size) { } // static -void RenderProcess::FreeSharedMemory(SharedMemory* mem) { +void RenderProcess::FreeSharedMemory(base::SharedMemory* mem) { if (self()->PutSharedMemInCache(mem)) { self()->ScheduleCacheClearer(); return; @@ -143,14 +143,14 @@ void RenderProcess::FreeSharedMemory(SharedMemory* mem) { } // static -void RenderProcess::DeleteSharedMem(SharedMemory* mem) { +void RenderProcess::DeleteSharedMem(base::SharedMemory* mem) { delete mem; } -SharedMemory* RenderProcess::GetSharedMemFromCache(size_t size) { +base::SharedMemory* RenderProcess::GetSharedMemFromCache(size_t size) { // look for a cached object that is suitable for the requested size. for (int i = 0; i < arraysize(shared_mem_cache_); ++i) { - SharedMemory* mem = shared_mem_cache_[i]; + base::SharedMemory* mem = shared_mem_cache_[i]; if (mem && mem->max_size() >= size) { shared_mem_cache_[i] = NULL; return mem; @@ -159,7 +159,7 @@ SharedMemory* RenderProcess::GetSharedMemFromCache(size_t size) { return NULL; } -bool RenderProcess::PutSharedMemInCache(SharedMemory* mem) { +bool RenderProcess::PutSharedMemInCache(base::SharedMemory* mem) { // simple algorithm: // - look for an empty slot to store mem, or // - if full, then replace any existing cache entry that is smaller than the @@ -171,7 +171,7 @@ bool RenderProcess::PutSharedMemInCache(SharedMemory* mem) { } } for (int i = 0; i < arraysize(shared_mem_cache_); ++i) { - SharedMemory* cached_mem = shared_mem_cache_[i]; + base::SharedMemory* cached_mem = shared_mem_cache_[i]; if (cached_mem->max_size() < mem->max_size()) { shared_mem_cache_[i] = mem; DeleteSharedMem(cached_mem); diff --git a/chrome/renderer/render_process.h b/chrome/renderer/render_process.h index 8fcb186..bdba635 100644 --- a/chrome/renderer/render_process.h +++ b/chrome/renderer/render_process.h @@ -30,14 +30,14 @@ class RenderProcess : public ChildProcess { // reported in the resulting SharedMemory object will be greater than or // equal to the requested size. This method returns NULL if unable to // allocate memory for some reason. - static SharedMemory* AllocSharedMemory(size_t size); + static base::SharedMemory* AllocSharedMemory(size_t size); // Frees shared memory allocated by AllocSharedMemory. You should only use // this function to free the SharedMemory object. - static void FreeSharedMemory(SharedMemory* mem); + static void FreeSharedMemory(base::SharedMemory* mem); // Deletes the shared memory allocated by AllocSharedMemory. - static void DeleteSharedMem(SharedMemory* mem); + static void DeleteSharedMem(base::SharedMemory* mem); private: friend class ChildProcessFactory<RenderProcess>; @@ -54,12 +54,12 @@ class RenderProcess : public ChildProcess { // Look in the shared memory cache for a suitable object to reuse. Returns // NULL if there is none. - SharedMemory* GetSharedMemFromCache(size_t size); + base::SharedMemory* GetSharedMemFromCache(size_t size); // Maybe put the given shared memory into the shared memory cache. Returns // true if the SharedMemory object was stored in the cache; otherwise, false // is returned. - bool PutSharedMemInCache(SharedMemory* mem); + bool PutSharedMemInCache(base::SharedMemory* mem); void ClearSharedMemCache(); @@ -76,7 +76,7 @@ class RenderProcess : public ChildProcess { // A very simplistic and small cache. If an entry in this array is non-null, // then it points to a SharedMemory object that is available for reuse. - SharedMemory* shared_mem_cache_[2]; + base::SharedMemory* shared_mem_cache_[2]; // This factory is used to lazily invoke ClearSharedMemCache. ScopedRunnableMethodFactory<RenderProcess> clearer_factory_; diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc index fd262de..60ac402 100644 --- a/chrome/renderer/render_thread.cc +++ b/chrome/renderer/render_thread.cc @@ -148,14 +148,15 @@ void RenderThread::CleanUp() { CoUninitialize(); } -void RenderThread::OnUpdateVisitedLinks(SharedMemoryHandle table) { +void RenderThread::OnUpdateVisitedLinks(base::SharedMemoryHandle table) { DCHECK(table) << "Bad table handle"; visited_link_slave_->Init(table); } -void RenderThread::OnUpdateGreasemonkeyScripts(SharedMemoryHandle scripts) { +void RenderThread::OnUpdateGreasemonkeyScripts( + base::SharedMemoryHandle scripts) { DCHECK(scripts) << "Bad scripts handle"; - greasemonkey_slave_->UpdateScripts(scripts); + greasemonkey_slave_->UpdateScripts(scripts); } void RenderThread::OnMessageReceived(const IPC::Message& msg) { diff --git a/chrome/renderer/render_thread.h b/chrome/renderer/render_thread.h index 38fd144..6de92324 100644 --- a/chrome/renderer/render_thread.h +++ b/chrome/renderer/render_thread.h @@ -93,8 +93,8 @@ class RenderThread : public IPC::Channel::Listener, virtual void CleanUp(); private: - void OnUpdateVisitedLinks(SharedMemoryHandle table); - void OnUpdateGreasemonkeyScripts(SharedMemoryHandle table); + void OnUpdateVisitedLinks(base::SharedMemoryHandle table); + void OnUpdateGreasemonkeyScripts(base::SharedMemoryHandle table); void OnPluginMessage(const std::wstring& dll_path, const std::vector<uint8>& data); diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 30cd633..7e812a45 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -581,7 +581,7 @@ void RenderView::PrintPage(const ViewMsg_PrintPage_Params& params, page_params.page_number = params.page_number; page_params.document_cookie = params.params.document_cookie; page_params.actual_shrink = shrink; - SharedMemory shared_buf; + base::SharedMemory shared_buf; // http://msdn2.microsoft.com/en-us/library/ms535522.aspx // Windows 2000/XP: When a page in a spooled file exceeds approximately 350 diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h index a78df39..7ee0f8f 100644 --- a/chrome/renderer/render_view.h +++ b/chrome/renderer/render_view.h @@ -38,7 +38,6 @@ class DebugMessageHandler; class GURL; -class SharedMemory; class SkBitmap; struct ThumbnailScore; class WebError; @@ -48,7 +47,7 @@ class WebPluginDelegateProxy; enum WebRequestCachePolicy; namespace webkit_glue { - struct FileUploadData; +struct FileUploadData; } // We need to prevent a page from trying to create infinite popups. It is not diff --git a/chrome/renderer/render_widget.cc b/chrome/renderer/render_widget.cc index ab1a270..7f0f7ca 100644 --- a/chrome/renderer/render_widget.cc +++ b/chrome/renderer/render_widget.cc @@ -354,7 +354,8 @@ void RenderWidget::ClearFocus() { webwidget_->SetFocus(false); } -void RenderWidget::PaintRect(const gfx::Rect& rect, SharedMemory* paint_buf) { +void RenderWidget::PaintRect(const gfx::Rect& rect, + base::SharedMemory* paint_buf) { gfx::PlatformCanvasWin canvas(rect.width(), rect.height(), true, paint_buf->handle()); // Bring the canvas into the coordinate system of the paint rect diff --git a/chrome/renderer/render_widget.h b/chrome/renderer/render_widget.h index f597dff..f69d77e 100644 --- a/chrome/renderer/render_widget.h +++ b/chrome/renderer/render_widget.h @@ -101,7 +101,7 @@ class RenderWidget : public IPC::Channel::Listener, // Paints the given rectangular region of the WebWidget into paint_buf (a // shared memory segment returned by AllocPaintBuf). The caller must ensure // that the given rect fits within the bounds of the WebWidget. - void PaintRect(const gfx::Rect& rect, SharedMemory* paint_buf); + void PaintRect(const gfx::Rect& rect, base::SharedMemory* paint_buf); // Get the size of the paint buffer for the given rectangle, rounding up to // the allocation granularity of the system. @@ -204,8 +204,8 @@ class RenderWidget : public IPC::Channel::Listener, // Shared memory handles that are currently in use to transfer an image to // the browser. - SharedMemory* current_paint_buf_; - SharedMemory* current_scroll_buf_; + base::SharedMemory* current_paint_buf_; + base::SharedMemory* current_scroll_buf_; // The smallest bounding rectangle that needs to be re-painted. This is non- // empty if a paint event is pending. diff --git a/chrome/renderer/renderer_glue.cc b/chrome/renderer/renderer_glue.cc index 1cc689f..0d958cf 100644 --- a/chrome/renderer/renderer_glue.cc +++ b/chrome/renderer/renderer_glue.cc @@ -95,10 +95,10 @@ void ScopedClipboardWriterGlue::WriteBitmap(const SkBitmap& bitmap) { shared_buf_->Unmap(); Clipboard::ObjectMapParam param1, param2; - SharedMemoryHandle smh = shared_buf_->handle(); + base::SharedMemoryHandle smh = shared_buf_->handle(); const char* shared_handle = reinterpret_cast<const char*>(&smh); - for (size_t i = 0; i < sizeof SharedMemoryHandle; i++) + for (size_t i = 0; i < sizeof base::SharedMemoryHandle; i++) param1.push_back(shared_handle[i]); const char* size_data = reinterpret_cast<const char*>(&size); diff --git a/chrome/renderer/visitedlink_slave.cc b/chrome/renderer/visitedlink_slave.cc index 3c928f9..1e6092b 100644 --- a/chrome/renderer/visitedlink_slave.cc +++ b/chrome/renderer/visitedlink_slave.cc @@ -15,14 +15,14 @@ VisitedLinkSlave::~VisitedLinkSlave() { // This function's job is to initialize the table with the given // shared memory handle. This memory is mappend into the process. -bool VisitedLinkSlave::Init(SharedMemoryHandle shared_memory) { +bool VisitedLinkSlave::Init(base::SharedMemoryHandle shared_memory) { // since this function may be called again to change the table, we may need // to free old objects FreeTable(); DCHECK(shared_memory_ == NULL && hash_table_ == NULL); // create the shared memory object - shared_memory_ = new SharedMemory(shared_memory, true); + shared_memory_ = new base::SharedMemory(shared_memory, true); if (!shared_memory_) return false; diff --git a/chrome/renderer/visitedlink_slave.h b/chrome/renderer/visitedlink_slave.h index ff5ff64..39752fd0 100644 --- a/chrome/renderer/visitedlink_slave.h +++ b/chrome/renderer/visitedlink_slave.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_WIN_RENDERER_VISITEDLINK_SLAVE_H__ -#define CHROME_WIN_RENDERER_VISITEDLINK_SLAVE_H__ +#ifndef CHROME_RENDERER_VISITEDLINK_SLAVE_H_ +#define CHROME_RENDERER_VISITEDLINK_SLAVE_H_ #include "base/shared_memory.h" #include "chrome/common/visitedlink_common.h" @@ -20,15 +20,15 @@ class VisitedLinkSlave : public VisitedLinkCommon // It can also be called again at any time to update the table that we're // using. The handle should be the handle generated by the VisitedLinkMaster. // Returns true on success. - bool Init(SharedMemoryHandle shared_memory); + bool Init(base::SharedMemoryHandle shared_memory); private: void FreeTable(); // shared memory consists of a SharedHeader followed by the table - SharedMemory* shared_memory_; + base::SharedMemory* shared_memory_; - DISALLOW_EVIL_CONSTRUCTORS(VisitedLinkSlave); + DISALLOW_COPY_AND_ASSIGN(VisitedLinkSlave); }; -#endif // WIN_RENDERER_VISITEDLINK_SLAVE_H__ +#endif // CHROME_RENDERER_VISITEDLINK_SLAVE_H_ diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc index efceffb..13b06a3 100644 --- a/chrome/renderer/webplugin_delegate_proxy.cc +++ b/chrome/renderer/webplugin_delegate_proxy.cc @@ -397,10 +397,10 @@ void WebPluginDelegateProxy::ResetWindowlessBitmaps() { } bool WebPluginDelegateProxy::CreateBitmap( - scoped_ptr<SharedMemory>* memory, + scoped_ptr<base::SharedMemory>* memory, scoped_ptr<gfx::PlatformCanvasWin>* canvas) { size_t size = GetPaintBufSize(plugin_rect_); - scoped_ptr<SharedMemory> new_shared_memory(new SharedMemory()); + scoped_ptr<base::SharedMemory> new_shared_memory(new base::SharedMemory()); if (!new_shared_memory->Create(L"", false, true, size)) return false; @@ -515,7 +515,7 @@ void WebPluginDelegateProxy::Print(HDC hdc) { PluginMsg_PrintResponse_Params params = { 0 }; Send(new PluginMsg_Print(instance_id_, ¶ms)); - SharedMemory memory(params.shared_memory, true); + base::SharedMemory memory(params.shared_memory, true); if (!memory.Map(params.size)) { NOTREACHED(); return; diff --git a/chrome/renderer/webplugin_delegate_proxy.h b/chrome/renderer/webplugin_delegate_proxy.h index b401baa..a11d083 100644 --- a/chrome/renderer/webplugin_delegate_proxy.h +++ b/chrome/renderer/webplugin_delegate_proxy.h @@ -144,7 +144,7 @@ class WebPluginDelegateProxy : public WebPluginDelegate, void ResetWindowlessBitmaps(); // Creates a shared memory section and canvas. - bool CreateBitmap(scoped_ptr<SharedMemory>* memory, + bool CreateBitmap(scoped_ptr<base::SharedMemory>* memory, scoped_ptr<gfx::PlatformCanvasWin>* canvas); RenderView* render_view_; @@ -182,11 +182,11 @@ class WebPluginDelegateProxy : public WebPluginDelegate, // store when we get an invalidate from it. The background bitmap is used // for transparent plugins, as they need the backgroud data during painting. bool transparent_; - scoped_ptr<SharedMemory> backing_store_; + scoped_ptr<base::SharedMemory> backing_store_; scoped_ptr<gfx::PlatformCanvasWin> backing_store_canvas_; - scoped_ptr<SharedMemory> transport_store_; + scoped_ptr<base::SharedMemory> transport_store_; scoped_ptr<gfx::PlatformCanvasWin> transport_store_canvas_; - scoped_ptr<SharedMemory> background_store_; + scoped_ptr<base::SharedMemory> background_store_; scoped_ptr<gfx::PlatformCanvasWin> background_store_canvas_; DISALLOW_EVIL_CONSTRUCTORS(WebPluginDelegateProxy); diff --git a/chrome/test/memory_test/memory_test.cc b/chrome/test/memory_test/memory_test.cc index d31c1e5..fc68ede 100644 --- a/chrome/test/memory_test/memory_test.cc +++ b/chrome/test/memory_test/memory_test.cc @@ -266,7 +266,7 @@ class MemoryTest : public UITest { void PrintIOPerfInfo(const wchar_t* test_name) { printf("\n"); BrowserProcessFilter chrome_filter(user_data_dir_); - process_util::NamedProcessIterator + base::NamedProcessIterator chrome_process_itr(chrome::kBrowserProcessExecutableName, &chrome_filter); @@ -281,10 +281,10 @@ class MemoryTest : public UITest { continue; } - scoped_ptr<process_util::ProcessMetrics> process_metrics; + scoped_ptr<base::ProcessMetrics> process_metrics; IO_COUNTERS io_counters; process_metrics.reset( - process_util::ProcessMetrics::CreateProcessMetrics(process_handle)); + base::ProcessMetrics::CreateProcessMetrics(process_handle)); ZeroMemory(&io_counters, sizeof(io_counters)); if (process_metrics.get()->GetIOCounters(&io_counters)) { @@ -318,7 +318,7 @@ class MemoryTest : public UITest { void PrintMemoryUsageInfo(const wchar_t* test_name) { printf("\n"); BrowserProcessFilter chrome_filter(user_data_dir_); - process_util::NamedProcessIterator + base::NamedProcessIterator chrome_process_itr(chrome::kBrowserProcessExecutableName, &chrome_filter); diff --git a/chrome/test/mini_installer_test/chrome_mini_installer.cc b/chrome/test/mini_installer_test/chrome_mini_installer.cc index d4f0f11..d56ec00 100644 --- a/chrome/test/mini_installer_test/chrome_mini_installer.cc +++ b/chrome/test/mini_installer_test/chrome_mini_installer.cc @@ -113,8 +113,8 @@ void ChromeMiniInstaller::UnInstall() { ASSERT_TRUE(file_util::PathExists(uninstall_path)); printf("\nUninstalling Chrome...\n"); - process_util::LaunchApp(L"\"" + uninstall_path + L"\"" + L" -uninstall", - false, false, NULL); + base::LaunchApp(L"\"" + uninstall_path + L"\"" + L" -uninstall", + false, false, NULL); printf("\nLaunched setup.exe -uninstall....\n"); ASSERT_TRUE(CloseWindow(mini_installer_constants::kChromeBuildType, WM_COMMAND)); @@ -124,8 +124,8 @@ void ChromeMiniInstaller::UnInstall() { DeleteAppFolder(); FindChromeShortcut(); CloseProcesses(mini_installer_constants::kIEExecutable); - ASSERT_EQ(0, process_util::GetProcessCount( - mini_installer_constants::kIEExecutable, NULL)); + ASSERT_EQ(0, + base::GetProcessCount(mini_installer_constants::kIEExecutable, NULL)); } // Takes care of Chrome uninstall dialog. @@ -154,13 +154,13 @@ void ChromeMiniInstaller::CloseChromeBrowser(LPCWSTR window_name) { // Checks for all requested running processes and kills them. void ChromeMiniInstaller::CloseProcesses(const std::wstring& executable_name) { int timer = 0; - while ((process_util::GetProcessCount(executable_name, NULL) > 0) && + while ((base::GetProcessCount(executable_name, NULL) > 0) && (timer < 20000)) { - process_util::KillProcesses(executable_name, 1, NULL); + base::KillProcesses(executable_name, 1, NULL); Sleep(200); timer = timer + 200; } - ASSERT_EQ(0, process_util::GetProcessCount(executable_name, NULL)); + ASSERT_EQ(0, base::GetProcessCount(executable_name, NULL)); } // Checks for Chrome registry keys. @@ -256,7 +256,7 @@ void ChromeMiniInstaller::LaunchExe(std::wstring path, const wchar_t process_name[]) { printf("\nBuild to be installed is: %ls\n", path.c_str()); ASSERT_TRUE(file_util::PathExists(path)); - process_util::LaunchApp(L"\"" + path + L"\"", false, false, NULL); + base::LaunchApp(L"\"" + path + L"\"", false, false, NULL); printf("Waiting while this process is running %ls ....", process_name); WaitUntilProcessStartsRunning(process_name); WaitUntilProcessStopsRunning(process_name); @@ -268,7 +268,7 @@ void ChromeMiniInstaller::VerifyChromeLaunch() { ASSERT_TRUE(PathService::Get(base::DIR_LOCAL_APP_DATA, &path)); file_util::AppendToPath(&path, mini_installer_constants::kChromeAppDir); file_util::AppendToPath(&path, installer_util::kChromeExe); - process_util::LaunchApp(L"\"" + path + L"\"", false, false, NULL); + base::LaunchApp(L"\"" + path + L"\"", false, false, NULL); WaitUntilProcessStartsRunning(installer_util::kChromeExe); Sleep(1200); } @@ -297,12 +297,12 @@ bool ChromeMiniInstaller::VerifyOverInstall( void ChromeMiniInstaller::WaitUntilProcessStartsRunning( const wchar_t process_name[]) { int timer = 0; - while ((process_util::GetProcessCount(process_name, NULL) == 0) && + while ((base::GetProcessCount(process_name, NULL) == 0) && (timer < 60000)) { Sleep(200); timer = timer + 200; } - ASSERT_NE(0, process_util::GetProcessCount(process_name, NULL)); + ASSERT_NE(0, base::GetProcessCount(process_name, NULL)); } // Waits until the process stops running. @@ -310,11 +310,11 @@ void ChromeMiniInstaller::WaitUntilProcessStopsRunning( const wchar_t process_name[]) { int timer = 0; printf("\nWaiting for this process to end... %ls\n", process_name); - while ((process_util::GetProcessCount(process_name, NULL) > 0) && + while ((base::GetProcessCount(process_name, NULL) > 0) && (timer < 60000)) { Sleep(200); timer = timer + 200; } - ASSERT_EQ(0, process_util::GetProcessCount(process_name, NULL)); + ASSERT_EQ(0, base::GetProcessCount(process_name, NULL)); } diff --git a/chrome/test/page_cycler/page_cycler_test.cc b/chrome/test/page_cycler/page_cycler_test.cc index aab3eed..59d0ce8 100644 --- a/chrome/test/page_cycler/page_cycler_test.cc +++ b/chrome/test/page_cycler/page_cycler_test.cc @@ -90,7 +90,7 @@ class PageCyclerTest : public UITest { void PrintIOPerfInfo(const wchar_t* test_name) { BrowserProcessFilter chrome_filter(L""); - process_util::NamedProcessIterator + base::NamedProcessIterator chrome_process_itr(chrome::kBrowserProcessExecutableName, &chrome_filter); @@ -101,10 +101,10 @@ class PageCyclerTest : public UITest { false, pid); - scoped_ptr<process_util::ProcessMetrics> process_metrics; + scoped_ptr<base::ProcessMetrics> process_metrics; IO_COUNTERS io_counters; process_metrics.reset( - process_util::ProcessMetrics::CreateProcessMetrics(process_handle)); + base::ProcessMetrics::CreateProcessMetrics(process_handle)); ZeroMemory(&io_counters, sizeof(io_counters)); if (process_metrics.get()->GetIOCounters(&io_counters)) { @@ -160,7 +160,7 @@ class PageCyclerTest : public UITest { void PrintMemoryUsageInfo(const wchar_t* test_name) { BrowserProcessFilter chrome_filter(L""); - process_util::NamedProcessIterator + base::NamedProcessIterator chrome_process_itr(chrome::kBrowserProcessExecutableName, &chrome_filter); diff --git a/chrome/test/perf/mem_usage.cc b/chrome/test/perf/mem_usage.cc index c1d7941..fdfa435 100644 --- a/chrome/test/perf/mem_usage.cc +++ b/chrome/test/perf/mem_usage.cc @@ -81,7 +81,7 @@ size_t GetSystemCommitCharge() { void PrintChromeMemoryUsageInfo() { printf("\n"); BrowserProcessFilter chrome_filter(L""); - process_util::NamedProcessIterator + base::NamedProcessIterator chrome_process_itr(chrome::kBrowserProcessExecutableName, &chrome_filter); const PROCESSENTRY32* chrome_entry; diff --git a/chrome/test/perf/perftests.cc b/chrome/test/perf/perftests.cc index 2b1e4e5..3e67a6b 100644 --- a/chrome/test/perf/perftests.cc +++ b/chrome/test/perf/perftests.cc @@ -11,7 +11,7 @@ // TODO(darin): share code with base/run_all_perftests.cc int main(int argc, char **argv) { - process_util::EnableTerminationOnHeapCorruption(); + base::EnableTerminationOnHeapCorruption(); chrome::RegisterPathProvider(); MessageLoop main_message_loop; diff --git a/chrome/test/reliability/run_all_unittests.cc b/chrome/test/reliability/run_all_unittests.cc index bb045ca..1f7b2a3 100644 --- a/chrome/test/reliability/run_all_unittests.cc +++ b/chrome/test/reliability/run_all_unittests.cc @@ -7,7 +7,7 @@ #include "chrome/test/reliability/reliability_test_suite.h" int main(int argc, char **argv) { - process_util::EnableTerminationOnHeapCorruption(); + base::EnableTerminationOnHeapCorruption(); return ReliabilityTestSuite(argc, argv).Run(); } diff --git a/chrome/test/ui/run_all_unittests.cc b/chrome/test/ui/run_all_unittests.cc index 4400f9b..1670f1c 100644 --- a/chrome/test/ui/run_all_unittests.cc +++ b/chrome/test/ui/run_all_unittests.cc @@ -8,7 +8,7 @@ #include "chrome/test/ui/ui_test_suite.h" int main(int argc, char **argv) { - process_util::EnableTerminationOnHeapCorruption(); + base::EnableTerminationOnHeapCorruption(); PlatformThread::SetName("Tests_Main"); return UITestSuite(argc, argv).Run(); } diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc index f4371d2..41b1325 100644 --- a/chrome/test/ui/ui_test.cc +++ b/chrome/test/ui/ui_test.cc @@ -239,12 +239,11 @@ void UITest::LaunchBrowser(const std::wstring& arguments, bool clear_profile) { browser_launch_time_ = TimeTicks::Now(); - bool started = process_util::LaunchApp( - command_line, - false, // Don't wait for process object (doesn't work for - // us) - !show_window_, - &process_); + bool started = base::LaunchApp(command_line, + false, // Don't wait for process object + // (doesn't work for us) + !show_window_, + &process_); ASSERT_EQ(started, true); if (use_existing_browser_) { @@ -253,7 +252,7 @@ void UITest::LaunchBrowser(const std::wstring& arguments, bool clear_profile) { user_data_dir_.c_str()); GetWindowThreadProcessId(hwnd, &pid); // This mode doesn't work if we wound up launching a new browser ourselves. - ASSERT_NE(pid, process_util::GetProcId(process_)); + ASSERT_NE(pid, base::GetProcId(process_)); CloseHandle(process_); process_ = OpenProcess(SYNCHRONIZE, false, pid); } @@ -317,9 +316,9 @@ void UITest::CleanupAppProcesses() { // Make sure that no instances of the browser remain. const int kExitTimeoutMs = 5000; const int kExitCode = 1; - process_util::CleanupProcesses( - chrome::kBrowserProcessExecutableName, kExitTimeoutMs, kExitCode, - &filter); + base::CleanupProcesses( + chrome::kBrowserProcessExecutableName, kExitTimeoutMs, kExitCode, + &filter); // Suppress spammy failures that seem to be occurring when running // the UI tests in single-process mode. @@ -442,8 +441,8 @@ bool UITest::CrashAwareSleep(int time_out_ms) { /*static*/ int UITest::GetBrowserProcessCount() { BrowserProcessFilter filter(L""); - return process_util::GetProcessCount(chrome::kBrowserProcessExecutableName, - &filter); + return base::GetProcessCount(chrome::kBrowserProcessExecutableName, + &filter); } static DictionaryValue* LoadDictionaryValueFromPath(const std::wstring& path) { diff --git a/chrome/test/unit/run_all_unittests.cc b/chrome/test/unit/run_all_unittests.cc index 97d6719..4d16777 100644 --- a/chrome/test/unit/run_all_unittests.cc +++ b/chrome/test/unit/run_all_unittests.cc @@ -13,7 +13,7 @@ #endif int main(int argc, char **argv) { - process_util::EnableTerminationOnHeapCorruption(); + base::EnableTerminationOnHeapCorruption(); #if defined(OS_WIN) // TODO(port): This is not Windows-specific, but needs to be ported. return ChromeTestSuite(argc, argv).Run(); diff --git a/chrome/tools/convert_dict/convert_dict.cc b/chrome/tools/convert_dict/convert_dict.cc index ab486ac..870e322 100644 --- a/chrome/tools/convert_dict/convert_dict.cc +++ b/chrome/tools/convert_dict/convert_dict.cc @@ -71,7 +71,7 @@ int PrintHelp() { } // namespace int main(int argc, char* argv[]) { - process_util::EnableTerminationOnHeapCorruption(); + base::EnableTerminationOnHeapCorruption(); if (argc != 2) return PrintHelp(); diff --git a/chrome/tools/perf/flush_cache/flush_cache.cc b/chrome/tools/perf/flush_cache/flush_cache.cc index f10b69b..fa231d4 100644 --- a/chrome/tools/perf/flush_cache/flush_cache.cc +++ b/chrome/tools/perf/flush_cache/flush_cache.cc @@ -11,7 +11,7 @@ #include "chrome/test/test_file_util.h" int main(int argc, const char* argv[]) { - process_util::EnableTerminationOnHeapCorruption(); + base::EnableTerminationOnHeapCorruption(); if (argc <= 1) { fprintf(stderr, "flushes disk cache for files\n"); fprintf(stderr, "usage: %s <filenames>\n", argv[0]); diff --git a/chrome/tools/profiles/generate_profile.cc b/chrome/tools/profiles/generate_profile.cc index d60f3ae..42685a9 100644 --- a/chrome/tools/profiles/generate_profile.cc +++ b/chrome/tools/profiles/generate_profile.cc @@ -181,7 +181,7 @@ void InsertURLBatch(const std::wstring& profile_dir, int page_id, } int main(int argc, const char* argv[]) { - process_util::EnableTerminationOnHeapCorruption(); + base::EnableTerminationOnHeapCorruption(); base::AtExitManager exit_manager; int next_arg = 1; diff --git a/chrome/tools/test/image_diff/image_diff.cc b/chrome/tools/test/image_diff/image_diff.cc index 7b696d4..7fa6f48 100644 --- a/chrome/tools/test/image_diff/image_diff.cc +++ b/chrome/tools/test/image_diff/image_diff.cc @@ -233,7 +233,7 @@ int CompareImages(const char* file1, const char* file2) { } int main(int argc, const char* argv[]) { - process_util::EnableTerminationOnHeapCorruption(); + base::EnableTerminationOnHeapCorruption(); #if defined(OS_WIN) CommandLine parsed_command_line; #elif defined(OS_POSIX) |