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

Side by Side Diff: chrome/browser/extensions/api/page_capture/page_capture_api.cc

Issue 11458003: Remove scoped_refptr::release which is confusing and causes leaks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: duh Created 8 years 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
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 "chrome/browser/extensions/api/page_capture/page_capture_api.h" 5 #include "chrome/browser/extensions/api/page_capture/page_capture_api.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/extensions/extension_tab_util.h" 10 #include "chrome/browser/extensions/extension_tab_util.h"
(...skipping 26 matching lines...) Expand all
37 37
38 } // namespace 38 } // namespace
39 39
40 static PageCaptureSaveAsMHTMLFunction::TestDelegate* test_delegate_ = NULL; 40 static PageCaptureSaveAsMHTMLFunction::TestDelegate* test_delegate_ = NULL;
41 41
42 PageCaptureSaveAsMHTMLFunction::PageCaptureSaveAsMHTMLFunction() { 42 PageCaptureSaveAsMHTMLFunction::PageCaptureSaveAsMHTMLFunction() {
43 } 43 }
44 44
45 PageCaptureSaveAsMHTMLFunction::~PageCaptureSaveAsMHTMLFunction() { 45 PageCaptureSaveAsMHTMLFunction::~PageCaptureSaveAsMHTMLFunction() {
46 if (mhtml_file_.get()) { 46 if (mhtml_file_.get()) {
47 BrowserThread::ReleaseSoon(BrowserThread::IO, FROM_HERE, 47 webkit_blob::ShareableFileReference* to_release = mhtml_file_.get();
48 mhtml_file_.release()); 48 to_release->AddRef();
49 mhtml_file_ = NULL;
50 BrowserThread::ReleaseSoon(BrowserThread::IO, FROM_HERE, to_release);
49 } 51 }
50 } 52 }
51 53
52 void PageCaptureSaveAsMHTMLFunction::SetTestDelegate(TestDelegate* delegate) { 54 void PageCaptureSaveAsMHTMLFunction::SetTestDelegate(TestDelegate* delegate) {
53 test_delegate_ = delegate; 55 test_delegate_ = delegate;
54 } 56 }
55 57
56 bool PageCaptureSaveAsMHTMLFunction::RunImpl() { 58 bool PageCaptureSaveAsMHTMLFunction::RunImpl() {
57 params_ = SaveAsMHTML::Params::Create(*args_); 59 params_ = SaveAsMHTML::Params::Create(*args_);
58 EXTENSION_FUNCTION_VALIDATE(params_.get()); 60 EXTENSION_FUNCTION_VALIDATE(params_.get());
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 Browser* browser = NULL; 189 Browser* browser = NULL;
188 content::WebContents* web_contents = NULL; 190 content::WebContents* web_contents = NULL;
189 191
190 if (!ExtensionTabUtil::GetTabById(params_->details.tab_id, profile(), 192 if (!ExtensionTabUtil::GetTabById(params_->details.tab_id, profile(),
191 include_incognito(), &browser, NULL, 193 include_incognito(), &browser, NULL,
192 &web_contents, NULL)) { 194 &web_contents, NULL)) {
193 return NULL; 195 return NULL;
194 } 196 }
195 return web_contents; 197 return web_contents;
196 } 198 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698