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

Side by Side Diff: chrome/renderer/prerender/prerender_dispatcher.cc

Issue 10391134: Fix memory leak in PrerenderDispatcher. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 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/renderer/prerender/prerender_dispatcher.h" 5 #include "chrome/renderer/prerender/prerender_dispatcher.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/common/prerender_messages.h" 8 #include "chrome/common/prerender_messages.h"
9 #include "chrome/renderer/prerender/prerendering_support.h" 9 #include "chrome/renderer/prerender/prerendering_support.h"
10 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
11 #include "third_party/WebKit/Source/Platform/chromium/public/WebPrerenderingSupp ort.h" 11 #include "third_party/WebKit/Source/Platform/chromium/public/WebPrerenderingSupp ort.h"
12 12
13 namespace prerender { 13 namespace prerender {
14 14
15 PrerenderDispatcher::PrerenderDispatcher() { 15 PrerenderDispatcher::PrerenderDispatcher()
16 WebKit::WebPrerenderingSupport::initialize(new PrerenderingSupport()); 16 : prerendering_support_(new PrerenderingSupport()) {
17 WebKit::WebPrerenderingSupport::initialize(prerendering_support_.get());
dominich 2012/05/15 16:06:25 this seems like an arbitrary place to put this. Fo
gavinp 2012/05/18 05:46:25 OK, the new patch does it this way.
jam 2012/05/18 16:38:15 it seems that CCRC has less to do with prerenderin
17 } 18 }
18 19
19 PrerenderDispatcher::~PrerenderDispatcher() { 20 PrerenderDispatcher::~PrerenderDispatcher() {
21 if (prerendering_support_.get())
22 WebKit::WebPrerenderingSupport::shutdown();
20 } 23 }
21 24
22 bool PrerenderDispatcher::IsPrerenderURL(const GURL& url) const { 25 bool PrerenderDispatcher::IsPrerenderURL(const GURL& url) const {
23 return prerender_urls_.find(url) != prerender_urls_.end(); 26 return prerender_urls_.find(url) != prerender_urls_.end();
24 } 27 }
25 28
26 bool PrerenderDispatcher::OnControlMessageReceived( 29 bool PrerenderDispatcher::OnControlMessageReceived(
27 const IPC::Message& message) { 30 const IPC::Message& message) {
28 bool handled = true; 31 bool handled = true;
29 IPC_BEGIN_MESSAGE_MAP(PrerenderDispatcher, message) 32 IPC_BEGIN_MESSAGE_MAP(PrerenderDispatcher, message)
(...skipping 24 matching lines...) Expand all
54 // is unlikely to go to the prerendered page. 57 // is unlikely to go to the prerendered page.
55 if (it == prerender_urls_.end()) 58 if (it == prerender_urls_.end())
56 return; 59 return;
57 DCHECK(it->second > 0); 60 DCHECK(it->second > 0);
58 it->second -= 1; 61 it->second -= 1;
59 if (it->second == 0) 62 if (it->second == 0)
60 prerender_urls_.erase(it); 63 prerender_urls_.erase(it);
61 } 64 }
62 65
63 } // namespace prerender 66 } // namespace prerender
OLDNEW
« no previous file with comments | « chrome/renderer/prerender/prerender_dispatcher.h ('k') | tools/valgrind/memcheck/suppressions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698