diff options
author | xiaomings@google.com <xiaomings@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-28 20:19:51 +0000 |
---|---|---|
committer | xiaomings@google.com <xiaomings@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-28 20:19:51 +0000 |
commit | c51f2c7f2b44efd65df1418902cc5fa5e0a89951 (patch) | |
tree | 757d1a8a5275f26375762c471ecd442a003ab8b9 | |
parent | f0a4ed6188827c1030b3bb3f085c4b8144f15f71 (diff) | |
download | chromium_src-c51f2c7f2b44efd65df1418902cc5fa5e0a89951.zip chromium_src-c51f2c7f2b44efd65df1418902cc5fa5e0a89951.tar.gz chromium_src-c51f2c7f2b44efd65df1418902cc5fa5e0a89951.tar.bz2 |
Add WARN_UNUSED_RESULT to scoped_refptr::release.
Also fixed some possible leaks related by scoped_refptr::release.
See https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/b5thcBgubsM
BUG=
Review URL: https://chromiumcodereview.appspot.com/10874054
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@153719 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/memory/ref_counted.h | 3 | ||||
-rw-r--r-- | chrome/browser/sync/glue/browser_thread_model_worker_unittest.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/webui/tracing_ui.cc | 4 | ||||
-rw-r--r-- | chrome/service/cloud_print/cloud_print_connector.cc | 5 | ||||
-rw-r--r-- | gpu/command_buffer/service/context_group.cc | 6 | ||||
-rw-r--r-- | net/http/http_response_headers.cc | 2 |
6 files changed, 9 insertions, 13 deletions
diff --git a/base/memory/ref_counted.h b/base/memory/ref_counted.h index 35f515d..ba7e657 100644 --- a/base/memory/ref_counted.h +++ b/base/memory/ref_counted.h @@ -9,6 +9,7 @@ #include "base/atomic_ref_count.h" #include "base/base_export.h" +#include "base/compiler_specific.h" #include "base/threading/thread_collision_warner.h" namespace base { @@ -260,7 +261,7 @@ class scoped_refptr { // If this object holds a NULL pointer, the return value is NULL. // After this operation, this object will hold a NULL pointer, // and will not own the object any more. - T* release() { + T* release() WARN_UNUSED_RESULT { T* retVal = ptr_; ptr_ = NULL; return retVal; diff --git a/chrome/browser/sync/glue/browser_thread_model_worker_unittest.cc b/chrome/browser/sync/glue/browser_thread_model_worker_unittest.cc index 2c485d8..c774075 100644 --- a/chrome/browser/sync/glue/browser_thread_model_worker_unittest.cc +++ b/chrome/browser/sync/glue/browser_thread_model_worker_unittest.cc @@ -78,7 +78,7 @@ class SyncBrowserThreadModelWorkerTest : public testing::Test { } virtual void Teardown() { - worker_.release(); + worker_ = NULL; db_thread_.Stop(); } diff --git a/chrome/browser/ui/webui/tracing_ui.cc b/chrome/browser/ui/webui/tracing_ui.cc index 580b863..584cd30 100644 --- a/chrome/browser/ui/webui/tracing_ui.cc +++ b/chrome/browser/ui/webui/tracing_ui.cc @@ -353,11 +353,11 @@ void TracingMessageHandler::FileSelected( trace_data_to_save_.release())); } - select_trace_file_dialog_.release(); + select_trace_file_dialog_ = NULL; } void TracingMessageHandler::FileSelectionCanceled(void* params) { - select_trace_file_dialog_.release(); + select_trace_file_dialog_ = NULL; if (select_trace_file_dialog_type_ == ui::SelectFileDialog::SELECT_OPEN_FILE) { web_ui()->CallJavascriptFunction( diff --git a/chrome/service/cloud_print/cloud_print_connector.cc b/chrome/service/cloud_print/cloud_print_connector.cc index 4187ab0..9d8fc351 100644 --- a/chrome/service/cloud_print/cloud_print_connector.cc +++ b/chrome/service/cloud_print/cloud_print_connector.cc @@ -54,7 +54,7 @@ bool CloudPrintConnector::InitPrintSystem() { } cloud_print::PrintSystem::PrintSystemResult result = print_system_->Init(); if (!result.succeeded()) { - print_system_.release(); + print_system_ = NULL; // We could not initialize the print system. We need to notify the server. ReportUserMessage(kPrintSystemFailedMessageId, result.message()); return false; @@ -86,7 +86,7 @@ void CloudPrintConnector::Stop() { DCHECK(IsRunning()); // Do uninitialization here. pending_tasks_.clear(); - print_server_watcher_.release(); + print_server_watcher_ = NULL; request_ = NULL; } @@ -588,4 +588,3 @@ bool CloudPrintConnector::IsSamePrinter(const std::string& name1, const std::string& name2) const { return (0 == base::strcasecmp(name1.c_str(), name2.c_str())); } - diff --git a/gpu/command_buffer/service/context_group.cc b/gpu/command_buffer/service/context_group.cc index 74110e6..c18bb4e 100644 --- a/gpu/command_buffer/service/context_group.cc +++ b/gpu/command_buffer/service/context_group.cc @@ -247,9 +247,7 @@ void ContextGroup::Destroy(bool have_context) { shader_manager_.reset(); } - if (memory_tracker_.get()) { - memory_tracker_.release(); - } + memory_tracker_ = NULL; } IdAllocatorInterface* ContextGroup::GetIdAllocator(unsigned namespace_id) { @@ -311,5 +309,3 @@ bool ContextGroup::QueryGLFeatureU( } // namespace gles2 } // namespace gpu - - diff --git a/net/http/http_response_headers.cc b/net/http/http_response_headers.cc index 0d2279b..7e6b076 100644 --- a/net/http/http_response_headers.cc +++ b/net/http/http_response_headers.cc @@ -1293,7 +1293,7 @@ Value* HttpResponseHeaders::NetLogCallback( bool HttpResponseHeaders::FromNetLogParam( const base::Value* event_param, scoped_refptr<HttpResponseHeaders>* http_response_headers) { - http_response_headers->release(); + *http_response_headers = NULL; const base::DictionaryValue* dict; const base::ListValue* header_list; |