Skip to content

Commit

Permalink
Remove base/memory/scoped_handle.h
Browse files Browse the repository at this point in the history
Move the existing 8 users of ScopedStdioHandle (the only thing in this header) to using ScopedFILE like most other code. Remove the dead references to this header from other files in the codebase.

R=rvargas@chromium.org

Review URL: https://codereview.chromium.org/324773002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@276071 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
brettw@chromium.org committed Jun 10, 2014
1 parent 33bc2bc commit 0910bae
Show file tree
Hide file tree
Showing 24 changed files with 18 additions and 84 deletions.
1 change: 0 additions & 1 deletion base/base.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,6 @@
'memory/ref_counted_delete_on_message_loop.h',
'memory/ref_counted_memory.cc',
'memory/ref_counted_memory.h',
'memory/scoped_handle.h',
'memory/scoped_open_process.h',
'memory/scoped_policy.h',
'memory/scoped_ptr.h',
Expand Down
50 changes: 0 additions & 50 deletions base/memory/scoped_handle.h

This file was deleted.

2 changes: 1 addition & 1 deletion base/win/scoped_handle.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace win {

// Generic wrapper for raw handles that takes care of closing handles
// automatically. The class interface follows the style of
// the ScopedStdioHandle class with one addition:
// the ScopedFILE class with one addition:
// - IsValid() method can tolerate multiple invalid handle values such as NULL
// and INVALID_HANDLE_VALUE (-1) for Win32 handles.
template <class Traits, class Verifier>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "base/file_util.h"
#include "base/files/memory_mapped_file.h"
#include "base/json/json_file_value_serializer.h"
#include "base/memory/scoped_handle.h"
#include "base/path_service.h"
#include "base/strings/string_number_conversions.h"
#include "chrome/browser/component_updater/component_patcher.h"
Expand Down
6 changes: 3 additions & 3 deletions chrome/browser/component_updater/component_unpacker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
#include "base/bind.h"
#include "base/file_util.h"
#include "base/files/file_path.h"
#include "base/files/scoped_file.h"
#include "base/json/json_file_value_serializer.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/memory/scoped_handle.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
Expand Down Expand Up @@ -152,13 +152,13 @@ bool ComponentUnpacker::Verify() {
}
// First, validate the CRX header and signature. As of today
// this is SHA1 with RSA 1024.
ScopedStdioHandle file(base::OpenFile(path_, "rb"));
base::ScopedFILE file(base::OpenFile(path_, "rb"));
if (!file.get()) {
error_ = kInvalidFile;
return false;
}
CRXValidator validator(file.get());
file.Close();
file.reset();
if (!validator.valid()) {
error_ = kInvalidFile;
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#include "base/base64.h"
#include "base/bind.h"
#include "base/memory/scoped_handle.h"
#include "base/message_loop/message_loop.h"
#include "base/threading/sequenced_worker_pool.h"
#include "chrome/common/chrome_utility_messages.h"
Expand Down
10 changes: 5 additions & 5 deletions chrome/browser/extensions/extension_creator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/file_util.h"
#include "base/files/scoped_file.h"
#include "base/files/scoped_temp_dir.h"
#include "base/memory/scoped_handle.h"
#include "base/strings/string_util.h"
#include "chrome/browser/extensions/extension_creator_filter.h"
#include "crypto/rsa_private_key.h"
Expand Down Expand Up @@ -212,7 +212,7 @@ bool ExtensionCreator::SignZip(const base::FilePath& zip_path,
std::vector<uint8>* signature) {
scoped_ptr<crypto::SignatureCreator> signature_creator(
crypto::SignatureCreator::Create(private_key));
ScopedStdioHandle zip_handle(base::OpenFile(zip_path, "rb"));
base::ScopedFILE zip_handle(base::OpenFile(zip_path, "rb"));
size_t buffer_size = 1 << 16;
scoped_ptr<uint8[]> buffer(new uint8[buffer_size]);
int bytes_read = -1;
Expand All @@ -224,7 +224,7 @@ bool ExtensionCreator::SignZip(const base::FilePath& zip_path,
return false;
}
}
zip_handle.Close();
zip_handle.reset();

if (!signature_creator->Final(signature)) {
error_message_ =
Expand All @@ -240,7 +240,7 @@ bool ExtensionCreator::WriteCRX(const base::FilePath& zip_path,
const base::FilePath& crx_path) {
if (base::PathExists(crx_path))
base::DeleteFile(crx_path, false);
ScopedStdioHandle crx_handle(base::OpenFile(crx_path, "wb"));
base::ScopedFILE crx_handle(base::OpenFile(crx_path, "wb"));
if (!crx_handle.get()) {
error_message_ = l10n_util::GetStringUTF8(IDS_EXTENSION_SHARING_VIOLATION);
return false;
Expand Down Expand Up @@ -272,7 +272,7 @@ bool ExtensionCreator::WriteCRX(const base::FilePath& zip_path,
size_t buffer_size = 1 << 16;
scoped_ptr<uint8[]> buffer(new uint8[buffer_size]);
size_t bytes_read = 0;
ScopedStdioHandle zip_handle(base::OpenFile(zip_path, "rb"));
base::ScopedFILE zip_handle(base::OpenFile(zip_path, "rb"));
while ((bytes_read = fread(buffer.get(), 1, buffer_size,
zip_handle.get())) > 0) {
if (fwrite(buffer.get(), sizeof(char), bytes_read, crx_handle.get()) !=
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/extensions/external_registry_loader_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "base/bind.h"
#include "base/file_util.h"
#include "base/files/file_path.h"
#include "base/memory/scoped_handle.h"
#include "base/files/scoped_file.h"
#include "base/metrics/histogram.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
Expand Down Expand Up @@ -39,7 +39,7 @@ const wchar_t kRegistryExtensionVersion[] = L"version";
const wchar_t kRegistryExtensionUpdateUrl[] = L"update_url";

bool CanOpenFileForReading(const base::FilePath& path) {
ScopedStdioHandle file_handle(base::OpenFile(path, "rb"));
base::ScopedFILE file_handle(base::OpenFile(path, "rb"));
return file_handle.get() != NULL;
}

Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/extensions/sandboxed_unpacker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#include "base/command_line.h"
#include "base/file_util.h"
#include "base/files/file_util_proxy.h"
#include "base/files/scoped_file.h"
#include "base/json/json_string_value_serializer.h"
#include "base/memory/scoped_handle.h"
#include "base/message_loop/message_loop.h"
#include "base/metrics/histogram.h"
#include "base/numerics/safe_conversions.h"
Expand Down Expand Up @@ -420,7 +420,7 @@ void SandboxedUnpacker::OnUnpackExtensionFailed(const base::string16& error) {
}

bool SandboxedUnpacker::ValidateSignature() {
ScopedStdioHandle file(base::OpenFile(crx_path_, "rb"));
base::ScopedFILE file(base::OpenFile(crx_path_, "rb"));

if (!file.get()) {
// Could not open crx file for reading.
Expand Down
1 change: 0 additions & 1 deletion chrome/browser/extensions/updater/extension_downloader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "base/files/file_path.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/memory/scoped_handle.h"
#include "base/metrics/histogram.h"
#include "base/metrics/sparse_histogram.h"
#include "base/stl_util.h"
Expand Down
1 change: 0 additions & 1 deletion chrome/utility/extensions/unpacker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "base/files/scoped_temp_dir.h"
#include "base/i18n/rtl.h"
#include "base/json/json_file_value_serializer.h"
#include "base/memory/scoped_handle.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
Expand Down
1 change: 0 additions & 1 deletion content/common/gpu/media/dxva_video_decode_accelerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "base/command_line.h"
#include "base/debug/trace_event.h"
#include "base/logging.h"
#include "base/memory/scoped_handle.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/shared_memory.h"
#include "base/message_loop/message_loop.h"
Expand Down
1 change: 0 additions & 1 deletion content/plugin/plugin_channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#include <vector>
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_handle.h"
#include "base/process/process.h"
#include "build/build_config.h"
#include "content/child/npapi/np_channel_base.h"
Expand Down
1 change: 0 additions & 1 deletion content/plugin/webplugin_proxy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#include "base/bind.h"
#include "base/lazy_instance.h"
#include "base/memory/scoped_handle.h"
#include "base/memory/shared_memory.h"
#include "build/build_config.h"
#include "content/child/npapi/npobject_proxy.h"
Expand Down
1 change: 0 additions & 1 deletion content/plugin/webplugin_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#if defined(OS_MACOSX)
#include "base/mac/scoped_cftyperef.h"
#endif
#include "base/memory/scoped_handle.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/shared_memory.h"
#include "base/memory/weak_ptr.h"
Expand Down
1 change: 0 additions & 1 deletion content/renderer/render_thread_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@
#include <objbase.h>
#else
// TODO(port)
#include "base/memory/scoped_handle.h"
#include "content/child/npapi/np_channel_base.h"
#endif

Expand Down
6 changes: 3 additions & 3 deletions net/android/keystore_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "base/compiler_specific.h"
#include "base/file_util.h"
#include "base/files/file_path.h"
#include "base/memory/scoped_handle.h"
#include "base/files/scoped_file.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "crypto/openssl_util.h"
Expand Down Expand Up @@ -117,7 +117,7 @@ EVP_PKEY* ImportPrivateKeyFile(const char* filename) {
// Load file in memory.
base::FilePath certs_dir = GetTestCertsDirectory();
base::FilePath file_path = certs_dir.AppendASCII(filename);
ScopedStdioHandle handle(base::OpenFile(file_path, "rb"));
base::ScopedFILE handle(base::OpenFile(file_path, "rb"));
if (!handle.get()) {
LOG(ERROR) << "Could not open private key file: " << filename;
return NULL;
Expand Down Expand Up @@ -166,7 +166,7 @@ EVP_PKEY* ImportPublicKeyFile(const char* filename) {
// Load file as PEM data.
base::FilePath certs_dir = GetTestCertsDirectory();
base::FilePath file_path = certs_dir.AppendASCII(filename);
ScopedStdioHandle handle(base::OpenFile(file_path, "rb"));
base::ScopedFILE handle(base::OpenFile(file_path, "rb"));
if (!handle.get()) {
LOG(ERROR) << "Could not open public key file: " << filename;
return NULL;
Expand Down
4 changes: 2 additions & 2 deletions net/base/net_log_logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <stdio.h>

#include "base/memory/scoped_handle.h"
#include "base/files/scoped_file.h"
#include "net/base/net_log.h"

namespace base {
Expand Down Expand Up @@ -47,7 +47,7 @@ class NET_EXPORT NetLogLogger : public NetLog::ThreadSafeObserver {
static base::DictionaryValue* GetConstants();

private:
ScopedStdioHandle file_;
base::ScopedFILE file_;

// The LogLevel to log at.
NetLog::LogLevel log_level_;
Expand Down
1 change: 0 additions & 1 deletion net/socket/ssl_client_socket_openssl_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include "base/file_util.h"
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_handle.h"
#include "base/message_loop/message_loop_proxy.h"
#include "base/values.h"
#include "crypto/openssl_util.h"
Expand Down
1 change: 0 additions & 1 deletion remoting/base/vlog_net_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#ifndef REMOTING_BASE_VLOG_NET_LOG_H_
#define REMOTING_BASE_VLOG_NET_LOG_H_

#include "base/memory/scoped_handle.h"
#include "base/memory/scoped_ptr.h"
#include "net/base/net_log.h"

Expand Down
1 change: 0 additions & 1 deletion ui/base/clipboard/clipboard_util_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

#include "base/basictypes.h"
#include "base/logging.h"
#include "base/memory/scoped_handle.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
Expand Down
1 change: 0 additions & 1 deletion ui/base/dragdrop/os_exchange_data_provider_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "base/files/file_path.h"
#include "base/i18n/file_util_icu.h"
#include "base/logging.h"
#include "base/memory/scoped_handle.h"
#include "base/pickle.h"
#include "base/strings/utf_string_conversions.h"
#include "base/win/scoped_hglobal.h"
Expand Down
1 change: 0 additions & 1 deletion ui/base/dragdrop/os_exchange_data_win_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// found in the LICENSE file.

#include "base/memory/ref_counted.h"
#include "base/memory/scoped_handle.h"
#include "base/memory/scoped_ptr.h"
#include "base/strings/utf_string_conversions.h"
#include "base/win/scoped_hglobal.h"
Expand Down
1 change: 0 additions & 1 deletion ui/native_theme/native_theme_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

#include "base/basictypes.h"
#include "base/logging.h"
#include "base/memory/scoped_handle.h"
#include "base/memory/scoped_ptr.h"
#include "base/win/scoped_gdi_object.h"
#include "base/win/scoped_hdc.h"
Expand Down

0 comments on commit 0910bae

Please sign in to comment.