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

Side by Side Diff: chrome/browser/prerender/prerender_contents.h

Issue 2259533003: Use bounds instead of size for prerender requests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile on mac, update .mm Created 4 years, 4 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
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 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ 5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_
6 #define CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <string> 11 #include <string>
12 #include <utility> 12 #include <utility>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "base/observer_list.h" 17 #include "base/observer_list.h"
18 #include "base/time/time.h" 18 #include "base/time/time.h"
19 #include "base/values.h" 19 #include "base/values.h"
20 #include "chrome/browser/prerender/prerender_final_status.h" 20 #include "chrome/browser/prerender/prerender_final_status.h"
21 #include "chrome/browser/prerender/prerender_origin.h" 21 #include "chrome/browser/prerender/prerender_origin.h"
22 #include "content/public/browser/notification_observer.h" 22 #include "content/public/browser/notification_observer.h"
23 #include "content/public/browser/notification_registrar.h" 23 #include "content/public/browser/notification_registrar.h"
24 #include "content/public/browser/web_contents_observer.h" 24 #include "content/public/browser/web_contents_observer.h"
25 #include "content/public/common/referrer.h" 25 #include "content/public/common/referrer.h"
26 #include "ui/gfx/geometry/size.h" 26 #include "ui/gfx/geometry/rect.h"
27 27
28 class Profile; 28 class Profile;
29 29
30 namespace base { 30 namespace base {
31 class ProcessMetrics; 31 class ProcessMetrics;
32 } 32 }
33 33
34 namespace content { 34 namespace content {
35 class RenderViewHost; 35 class RenderViewHost;
36 class SessionStorageNamespace; 36 class SessionStorageNamespace;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 static Factory* CreateFactory(); 104 static Factory* CreateFactory();
105 105
106 // Returns a PrerenderContents from the given web_contents, if it's used for 106 // Returns a PrerenderContents from the given web_contents, if it's used for
107 // prerendering. Otherwise returns NULL. Handles a NULL input for 107 // prerendering. Otherwise returns NULL. Handles a NULL input for
108 // convenience. 108 // convenience.
109 static PrerenderContents* FromWebContents(content::WebContents* web_contents); 109 static PrerenderContents* FromWebContents(content::WebContents* web_contents);
110 110
111 // Start rendering the contents in the prerendered state. If 111 // Start rendering the contents in the prerendered state. If
112 // |is_control_group| is true, this will go through some of the mechanics of 112 // |is_control_group| is true, this will go through some of the mechanics of
113 // starting a prerender, without actually creating the RenderView. |size| 113 // starting a prerender, without actually creating the RenderView. |bounds|
114 // indicates the rectangular dimensions that the prerendered page should be. 114 // indicates the rectangular dimensions that the prerendered page should have.
pasko 2016/08/22 15:17:58 it is not only the dimensions, but the 4 values de
Yusuf 2016/08/22 16:38:49 Done.
115 // |session_storage_namespace| indicates the namespace that the prerendered 115 // |session_storage_namespace| indicates the namespace that the prerendered
116 // page should be part of. 116 // page should be part of.
117 virtual void StartPrerendering( 117 virtual void StartPrerendering(
118 const gfx::Size& size, 118 const gfx::Rect& bounds,
119 content::SessionStorageNamespace* session_storage_namespace); 119 content::SessionStorageNamespace* session_storage_namespace);
120 120
121 // Verifies that the prerendering is not using too many resources, and kills 121 // Verifies that the prerendering is not using too many resources, and kills
122 // it if not. 122 // it if not.
123 void DestroyWhenUsingTooManyResources(); 123 void DestroyWhenUsingTooManyResources();
124 124
125 content::RenderViewHost* GetRenderViewHostMutable(); 125 content::RenderViewHost* GetRenderViewHostMutable();
126 const content::RenderViewHost* GetRenderViewHost() const; 126 const content::RenderViewHost* GetRenderViewHost() const;
127 127
128 PrerenderManager* prerender_manager() { return prerender_manager_; } 128 PrerenderManager* prerender_manager() { return prerender_manager_; }
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 336
337 std::unique_ptr<WebContentsDelegateImpl> web_contents_delegate_; 337 std::unique_ptr<WebContentsDelegateImpl> web_contents_delegate_;
338 338
339 // These are -1 before a RenderView is created. 339 // These are -1 before a RenderView is created.
340 int child_id_; 340 int child_id_;
341 int route_id_; 341 int route_id_;
342 342
343 // Origin for this prerender. 343 // Origin for this prerender.
344 Origin origin_; 344 Origin origin_;
345 345
346 // The size of the WebView from the launching page. 346 // The bounds of the WebView from the launching page.
347 gfx::Size size_; 347 gfx::Rect bounds_;
348 348
349 typedef std::vector<history::HistoryAddPageArgs> AddPageVector; 349 typedef std::vector<history::HistoryAddPageArgs> AddPageVector;
350 350
351 // Caches pages to be added to the history. 351 // Caches pages to be added to the history.
352 AddPageVector add_page_vector_; 352 AddPageVector add_page_vector_;
353 353
354 // Resources that are throttled, pending a prerender use. Can only access a 354 // Resources that are throttled, pending a prerender use. Can only access a
355 // throttle on the IO thread. 355 // throttle on the IO thread.
356 std::vector<base::WeakPtr<PrerenderResourceThrottle> > resource_throttles_; 356 std::vector<base::WeakPtr<PrerenderResourceThrottle> > resource_throttles_;
357 357
358 // A running tally of the number of bytes this prerender has caused to be 358 // A running tally of the number of bytes this prerender has caused to be
359 // transferred over the network for resources. Updated with AddNetworkBytes. 359 // transferred over the network for resources. Updated with AddNetworkBytes.
360 int64_t network_bytes_; 360 int64_t network_bytes_;
361 361
362 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); 362 DISALLOW_COPY_AND_ASSIGN(PrerenderContents);
363 }; 363 };
364 364
365 } // namespace prerender 365 } // namespace prerender
366 366
367 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ 367 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_
OLDNEW
« no previous file with comments | « chrome/browser/prerender/external_prerender_handler_android.cc ('k') | chrome/browser/prerender/prerender_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698