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

Side by Side Diff: chrome/browser/android/offline_pages/prerendering_loader.cc

Issue 2357013002: Fix an issue that PrerenderLoader::OnPrerenderStart() never gets called. (Closed)
Patch Set: Created 4 years, 3 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/browser/android/offline_pages/prerender_adapter.cc ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/offline_pages/prerendering_loader.h" 5 #include "chrome/browser/android/offline_pages/prerendering_loader.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 bool accepted = adapter_->StartPrerender( 51 bool accepted = adapter_->StartPrerender(
52 browser_context_, url, sessionStorageNamespace, renderWindowSize); 52 browser_context_, url, sessionStorageNamespace, renderWindowSize);
53 if (!accepted) 53 if (!accepted)
54 return false; 54 return false;
55 55
56 DCHECK(adapter_->IsActive()); 56 DCHECK(adapter_->IsActive());
57 snapshot_controller_.reset( 57 snapshot_controller_.reset(
58 new SnapshotController(base::ThreadTaskRunnerHandle::Get(), this)); 58 new SnapshotController(base::ThreadTaskRunnerHandle::Get(), this));
59 callback_ = callback; 59 callback_ = callback;
60 session_contents_.swap(new_web_contents); 60 session_contents_.swap(new_web_contents);
61 state_ = State::PENDING; 61 state_ = State::PENDING;
dougarnett 2016/09/21 16:16:51 Could just set LOADING here instead and drop the O
dougarnett 2016/09/21 16:32:40 BTW, I could do that clean up as it is a bit more
qinmin 2016/09/21 16:40:04 Can you take another look at the new patch, I have
62 // Note: Observer is attached too late when calling
63 // PrerenderAdapter::StartPrerenderer(). Call the missing OnPrerenderStart()
64 // here.
65 OnPrerenderStart();
62 return true; 66 return true;
63 } 67 }
64 68
65 void PrerenderingLoader::StopLoading() { 69 void PrerenderingLoader::StopLoading() {
66 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 70 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
67 CancelPrerender(); 71 CancelPrerender();
68 } 72 }
69 73
70 bool PrerenderingLoader::CanPrerender() { 74 bool PrerenderingLoader::CanPrerender() {
71 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 75 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 void PrerenderingLoader::CancelPrerender() { 203 void PrerenderingLoader::CancelPrerender() {
200 if (adapter_->IsActive()) { 204 if (adapter_->IsActive()) {
201 adapter_->DestroyActive(); 205 adapter_->DestroyActive();
202 } 206 }
203 snapshot_controller_.reset(nullptr); 207 snapshot_controller_.reset(nullptr);
204 session_contents_.reset(nullptr); 208 session_contents_.reset(nullptr);
205 state_ = State::IDLE; 209 state_ = State::IDLE;
206 } 210 }
207 211
208 } // namespace offline_pages 212 } // namespace offline_pages
OLDNEW
« no previous file with comments | « chrome/browser/android/offline_pages/prerender_adapter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698