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

Side by Side Diff: chrome/browser/automation/testing_automation_provider.cc

Issue 14137013: Remove base/mac/mach_ipc_mac.{h,mm}. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/mach_ipc_mac.mm ('k') | content/app/content_main_runner.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/automation/testing_automation_provider.h" 5 #include "chrome/browser/automation/testing_automation_provider.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 152
153 #if defined(ENABLE_CONFIGURATION_POLICY) 153 #if defined(ENABLE_CONFIGURATION_POLICY)
154 #include "chrome/browser/policy/policy_service.h" 154 #include "chrome/browser/policy/policy_service.h"
155 #endif 155 #endif
156 156
157 #if defined(OS_CHROMEOS) 157 #if defined(OS_CHROMEOS)
158 #include "chromeos/dbus/dbus_thread_manager.h" 158 #include "chromeos/dbus/dbus_thread_manager.h"
159 #endif 159 #endif
160 160
161 #if defined(OS_MACOSX) 161 #if defined(OS_MACOSX)
162 #include "base/mach_ipc_mac.h" 162 #include <mach/mach.h>
163 #include <mach/mach_vm.h>
163 #endif 164 #endif
164 165
165 #if !defined(NO_TCMALLOC) && (defined(OS_LINUX) || defined(OS_CHROMEOS)) 166 #if !defined(NO_TCMALLOC) && (defined(OS_LINUX) || defined(OS_CHROMEOS))
166 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h" 167 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h"
167 #endif // !defined(NO_TCMALLOC) && (defined(OS_LINUX) || defined(OS_CHROMEOS)) 168 #endif // !defined(NO_TCMALLOC) && (defined(OS_LINUX) || defined(OS_CHROMEOS))
168 169
169 using automation::Error; 170 using automation::Error;
170 using automation::ErrorCode; 171 using automation::ErrorCode;
171 using automation_util::SendErrorIfModalDialogActive; 172 using automation_util::SendErrorIfModalDialogActive;
172 using content::BrowserChildProcessHostIterator; 173 using content::BrowserChildProcessHostIterator;
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 delete observer; 484 delete observer;
484 485
485 AutomationMsg_AppendTab::WriteReplyParams(reply_message, 486 AutomationMsg_AppendTab::WriteReplyParams(reply_message,
486 append_tab_response); 487 append_tab_response);
487 Send(reply_message); 488 Send(reply_message);
488 } 489 }
489 } 490 }
490 491
491 void TestingAutomationProvider::GetMachPortCount(int* port_count) { 492 void TestingAutomationProvider::GetMachPortCount(int* port_count) {
492 #if defined(OS_MACOSX) 493 #if defined(OS_MACOSX)
493 base::mac::GetNumberOfMachPorts(mach_task_self(), port_count); 494 mach_port_name_array_t names;
495 mach_msg_type_number_t names_count;
496 mach_port_type_array_t types;
497 mach_msg_type_number_t types_count;
498
499 mach_port_t port = mach_task_self();
500
501 // A friendlier interface would allow NULL buffers to only get the counts.
502 kern_return_t kr = mach_port_names(port, &names, &names_count,
503 &types, &types_count);
504 if (kr != KERN_SUCCESS) {
505 *port_count = 0;
506 return;
507 }
508
509 // The documentation states this is an invariant.
510 DCHECK_EQ(names_count, types_count);
511 *port_count = names_count;
512
513 mach_vm_deallocate(port, reinterpret_cast<mach_vm_address_t>(names),
514 names_count * sizeof(mach_port_name_array_t));
515 mach_vm_deallocate(port, reinterpret_cast<mach_vm_address_t>(types),
516 types_count * sizeof(mach_port_type_array_t));
494 #else 517 #else
495 *port_count = 0; 518 *port_count = 0;
496 #endif 519 #endif
497 } 520 }
498 521
499 void TestingAutomationProvider::GetActiveTabIndex(int handle, 522 void TestingAutomationProvider::GetActiveTabIndex(int handle,
500 int* active_tab_index) { 523 int* active_tab_index) {
501 *active_tab_index = -1; // -1 is the error code 524 *active_tab_index = -1; // -1 is the error code
502 if (browser_tracker_->ContainsHandle(handle)) { 525 if (browser_tracker_->ContainsHandle(handle)) {
503 Browser* browser = browser_tracker_->GetResource(handle); 526 Browser* browser = browser_tracker_->GetResource(handle);
(...skipping 5418 matching lines...) Expand 10 before | Expand all | Expand 10 after
5922 if (g_browser_process) 5945 if (g_browser_process)
5923 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); 5946 g_browser_process->GetAutomationProviderList()->RemoveProvider(this);
5924 } 5947 }
5925 5948
5926 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, 5949 void TestingAutomationProvider::EnsureTabSelected(Browser* browser,
5927 WebContents* tab) { 5950 WebContents* tab) {
5928 TabStripModel* tab_strip = browser->tab_strip_model(); 5951 TabStripModel* tab_strip = browser->tab_strip_model();
5929 if (tab_strip->GetActiveWebContents() != tab) 5952 if (tab_strip->GetActiveWebContents() != tab)
5930 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true); 5953 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true);
5931 } 5954 }
OLDNEW
« no previous file with comments | « base/mach_ipc_mac.mm ('k') | content/app/content_main_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698