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

Unified Diff: chrome/test/automation/window_proxy.cc

Issue 113722: Make automation proxy objects to ref_counted. That allows to process async no... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/automation/window_proxy.h ('k') | chrome/test/interactive_ui/npapi_interactive_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/automation/window_proxy.cc
===================================================================
--- chrome/test/automation/window_proxy.cc (revision 17078)
+++ chrome/test/automation/window_proxy.cc (working copy)
@@ -118,14 +118,14 @@
view_id));
}
-BrowserProxy* WindowProxy::GetBrowser() {
+scoped_refptr<BrowserProxy> WindowProxy::GetBrowser() {
return GetBrowserWithTimeout(base::kNoTimeout, NULL);
}
-BrowserProxy* WindowProxy::GetBrowserWithTimeout(uint32 timeout_ms,
- bool* is_timeout) {
+scoped_refptr<BrowserProxy> WindowProxy::GetBrowserWithTimeout(
+ uint32 timeout_ms, bool* is_timeout) {
if (!is_valid())
- return false;
+ return NULL;
bool handle_ok = false;
int browser_handle = 0;
@@ -135,5 +135,15 @@
if (!handle_ok)
return NULL;
- return new BrowserProxy(sender_, tracker_, browser_handle);
+ BrowserProxy* browser =
+ static_cast<BrowserProxy*>(tracker_->GetResource(browser_handle));
+ if (!browser) {
+ browser = new BrowserProxy(sender_, tracker_, browser_handle);
+ browser->AddRef();
+ }
+
+ // Since there is no scoped_refptr::attach.
+ scoped_refptr<BrowserProxy> result;
+ result.swap(&browser);
+ return result;
}
« no previous file with comments | « chrome/test/automation/window_proxy.h ('k') | chrome/test/interactive_ui/npapi_interactive_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698