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

Side by Side Diff: chrome/browser/android/dev_tools_manager_delegate_android.cc

Issue 618513002: [DevTools] Address crash by checking if Tab loaded successfully (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/Tab.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/android/dev_tools_manager_delegate_android.h" 5 #include "chrome/browser/android/dev_tools_manager_delegate_android.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 int index; 133 int index;
134 if (!FindTab(&model, &index)) 134 if (!FindTab(&model, &index))
135 return NULL; 135 return NULL;
136 WebContents* web_contents = model->GetWebContentsAt(index); 136 WebContents* web_contents = model->GetWebContentsAt(index);
137 if (!web_contents) { 137 if (!web_contents) {
138 // The tab has been pushed out of memory, pull it back. 138 // The tab has been pushed out of memory, pull it back.
139 TabAndroid* tab = model->GetTabAt(index); 139 TabAndroid* tab = model->GetTabAt(index);
140 if (!tab) 140 if (!tab)
141 return NULL; 141 return NULL;
142 142
143 tab->LoadIfNeeded(); 143 if (!tab->LoadIfNeeded())
144 return NULL;
145
144 web_contents = model->GetWebContentsAt(index); 146 web_contents = model->GetWebContentsAt(index);
145 if (!web_contents) 147 if (!web_contents)
146 return NULL; 148 return NULL;
147 } 149 }
148 return DevToolsAgentHost::GetOrCreateFor(web_contents); 150 return DevToolsAgentHost::GetOrCreateFor(web_contents);
149 } 151 }
150 152
151 virtual bool Activate() const OVERRIDE { 153 virtual bool Activate() const OVERRIDE {
152 TabModel* model; 154 TabModel* model;
153 int index; 155 int index;
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 const GURL& url) { 338 const GURL& url) {
337 Profile* profile = ProfileManager::GetLastUsedProfile()->GetOriginalProfile(); 339 Profile* profile = ProfileManager::GetLastUsedProfile()->GetOriginalProfile();
338 history::TopSites* top_sites = profile->GetTopSites(); 340 history::TopSites* top_sites = profile->GetTopSites();
339 if (top_sites) { 341 if (top_sites) {
340 scoped_refptr<base::RefCountedMemory> data; 342 scoped_refptr<base::RefCountedMemory> data;
341 if (top_sites->GetPageThumbnail(url, false, &data)) 343 if (top_sites->GetPageThumbnail(url, false, &data))
342 return std::string(data->front_as<char>(), data->size()); 344 return std::string(data->front_as<char>(), data->size());
343 } 345 }
344 return std::string(); 346 return std::string();
345 } 347 }
OLDNEW
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/Tab.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698