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

Side by Side Diff: sandbox/win/src/handle_closer_agent.cc

Issue 111373008: Update some uses of char16 to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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 | « sandbox/win/src/handle_closer.cc ('k') | sandbox/win/src/handle_table.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "sandbox/win/src/handle_closer_agent.h" 5 #include "sandbox/win/src/handle_closer_agent.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "sandbox/win/src/nt_internals.h" 8 #include "sandbox/win/src/nt_internals.h"
9 #include "sandbox/win/src/win_utils.h" 9 #include "sandbox/win/src/win_utils.h"
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 } 42 }
43 43
44 // Reads g_handles_to_close and creates the lookup map. 44 // Reads g_handles_to_close and creates the lookup map.
45 void HandleCloserAgent::InitializeHandlesToClose() { 45 void HandleCloserAgent::InitializeHandlesToClose() {
46 CHECK(g_handles_to_close != NULL); 46 CHECK(g_handles_to_close != NULL);
47 47
48 // Grab the header. 48 // Grab the header.
49 HandleListEntry* entry = g_handles_to_close->handle_entries; 49 HandleListEntry* entry = g_handles_to_close->handle_entries;
50 for (size_t i = 0; i < g_handles_to_close->num_handle_types; ++i) { 50 for (size_t i = 0; i < g_handles_to_close->num_handle_types; ++i) {
51 // Set the type name. 51 // Set the type name.
52 char16* input = entry->handle_type; 52 base::char16* input = entry->handle_type;
53 HandleMap::mapped_type& handle_names = handles_to_close_[input]; 53 HandleMap::mapped_type& handle_names = handles_to_close_[input];
54 input = reinterpret_cast<char16*>(reinterpret_cast<char*>(entry) 54 input = reinterpret_cast<base::char16*>(reinterpret_cast<char*>(entry)
55 + entry->offset_to_names); 55 + entry->offset_to_names);
56 // Grab all the handle names. 56 // Grab all the handle names.
57 for (size_t j = 0; j < entry->name_count; ++j) { 57 for (size_t j = 0; j < entry->name_count; ++j) {
58 std::pair<HandleMap::mapped_type::iterator, bool> name 58 std::pair<HandleMap::mapped_type::iterator, bool> name
59 = handle_names.insert(input); 59 = handle_names.insert(input);
60 CHECK(name.second); 60 CHECK(name.second);
61 input += name.first->size() + 1; 61 input += name.first->size() + 1;
62 } 62 }
63 63
64 // Move on to the next entry. 64 // Move on to the next entry.
65 entry = reinterpret_cast<HandleListEntry*>(reinterpret_cast<char*>(entry) 65 entry = reinterpret_cast<HandleListEntry*>(reinterpret_cast<char*>(entry)
66 + entry->record_bytes); 66 + entry->record_bytes);
67 67
68 DCHECK(reinterpret_cast<char16*>(entry) >= input); 68 DCHECK(reinterpret_cast<base::char16*>(entry) >= input);
69 DCHECK(reinterpret_cast<char16*>(entry) - input < 69 DCHECK(reinterpret_cast<base::char16*>(entry) - input <
70 sizeof(size_t) / sizeof(char16)); 70 sizeof(size_t) / sizeof(base::char16));
71 } 71 }
72 72
73 // Clean up the memory we copied over. 73 // Clean up the memory we copied over.
74 ::VirtualFree(g_handles_to_close, 0, MEM_RELEASE); 74 ::VirtualFree(g_handles_to_close, 0, MEM_RELEASE);
75 g_handles_to_close = NULL; 75 g_handles_to_close = NULL;
76 } 76 }
77 77
78 bool HandleCloserAgent::CloseHandles() { 78 bool HandleCloserAgent::CloseHandles() {
79 DWORD handle_count = UINT_MAX; 79 DWORD handle_count = UINT_MAX;
80 const int kInvalidHandleThreshold = 100; 80 const int kInvalidHandleThreshold = 100;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 return false; 136 return false;
137 if (!::CloseHandle(handle)) 137 if (!::CloseHandle(handle))
138 return false; 138 return false;
139 } 139 }
140 } 140 }
141 141
142 return true; 142 return true;
143 } 143 }
144 144
145 } // namespace sandbox 145 } // namespace sandbox
OLDNEW
« no previous file with comments | « sandbox/win/src/handle_closer.cc ('k') | sandbox/win/src/handle_table.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698