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

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: 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 #endif 163 #endif
164 164
165 #if !defined(NO_TCMALLOC) && (defined(OS_LINUX) || defined(OS_CHROMEOS)) 165 #if !defined(NO_TCMALLOC) && (defined(OS_LINUX) || defined(OS_CHROMEOS))
166 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h" 166 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h"
167 #endif // !defined(NO_TCMALLOC) && (defined(OS_LINUX) || defined(OS_CHROMEOS)) 167 #endif // !defined(NO_TCMALLOC) && (defined(OS_LINUX) || defined(OS_CHROMEOS))
168 168
169 using automation::Error; 169 using automation::Error;
170 using automation::ErrorCode; 170 using automation::ErrorCode;
171 using automation_util::SendErrorIfModalDialogActive; 171 using automation_util::SendErrorIfModalDialogActive;
172 using content::BrowserChildProcessHostIterator; 172 using content::BrowserChildProcessHostIterator;
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 delete observer; 483 delete observer;
484 484
485 AutomationMsg_AppendTab::WriteReplyParams(reply_message, 485 AutomationMsg_AppendTab::WriteReplyParams(reply_message,
486 append_tab_response); 486 append_tab_response);
487 Send(reply_message); 487 Send(reply_message);
488 } 488 }
489 } 489 }
490 490
491 void TestingAutomationProvider::GetMachPortCount(int* port_count) { 491 void TestingAutomationProvider::GetMachPortCount(int* port_count) {
492 #if defined(OS_MACOSX) 492 #if defined(OS_MACOSX)
493 base::mac::GetNumberOfMachPorts(mach_task_self(), port_count); 493 mach_port_name_array_t names;
494 mach_msg_type_number_t names_count;
495 mach_port_type_array_t types;
496 mach_msg_type_number_t types_count;
497
498 // A friendlier interface would allow NULL buffers to only get the counts.
499 kern_return_t kr = mach_port_names(mach_task_self(), &names, &names_count,
Mark Mentovai 2013/04/11 17:02:56 local for mach_task_self() (yeah, even though…)
Robert Sesek 2013/04/11 17:10:32 Done.
500 &types, &types_count);
501 if (kr != KERN_SUCCESS) {
502 *port_count = -1;
Mark Mentovai 2013/04/11 17:02:56 -1 for failure on Mac but 0 for “not implemented”
Robert Sesek 2013/04/11 17:10:32 Done.
503 return;
504 }
505
506 // The documentation states this is an invariant.
507 DCHECK_EQ(names_count, types_count);
508 *port_count = names_count;
509
510 vm_deallocate(mach_task_self(),
Mark Mentovai 2013/04/11 17:02:56 For 64-bit compatibility, use mach_vm_deallocate i
Robert Sesek 2013/04/11 17:10:32 Done.
511 reinterpret_cast<vm_address_t>(names),
512 names_count * sizeof(mach_port_name_array_t));
513 vm_deallocate(mach_task_self(),
514 reinterpret_cast<vm_address_t>(types),
515 types_count * sizeof(mach_port_type_array_t));
516
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