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

Side by Side Diff: chrome/renderer/visitedlink_slave.cc

Issue 10895: Add Terminate() to the Process object, have RenderProcessHost use this to avo... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 1 month 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
« no previous file with comments | « chrome/renderer/visitedlink_slave.h ('k') | chrome/renderer/webplugin_delegate_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/visitedlink_slave.h" 5 #include "chrome/renderer/visitedlink_slave.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/shared_memory.h" 8 #include "base/shared_memory.h"
9 9
10 VisitedLinkSlave::VisitedLinkSlave() : shared_memory_(NULL) { 10 VisitedLinkSlave::VisitedLinkSlave() : shared_memory_(NULL) {
11 } 11 }
12 VisitedLinkSlave::~VisitedLinkSlave() { 12 VisitedLinkSlave::~VisitedLinkSlave() {
13 FreeTable(); 13 FreeTable();
14 } 14 }
15 15
16 // This function's job is to initialize the table with the given 16 // This function's job is to initialize the table with the given
17 // shared memory handle. This memory is mappend into the process. 17 // shared memory handle. This memory is mappend into the process.
18 bool VisitedLinkSlave::Init(SharedMemoryHandle shared_memory) { 18 bool VisitedLinkSlave::Init(base::SharedMemoryHandle shared_memory) {
19 // since this function may be called again to change the table, we may need 19 // since this function may be called again to change the table, we may need
20 // to free old objects 20 // to free old objects
21 FreeTable(); 21 FreeTable();
22 DCHECK(shared_memory_ == NULL && hash_table_ == NULL); 22 DCHECK(shared_memory_ == NULL && hash_table_ == NULL);
23 23
24 // create the shared memory object 24 // create the shared memory object
25 shared_memory_ = new SharedMemory(shared_memory, true); 25 shared_memory_ = new base::SharedMemory(shared_memory, true);
26 if (!shared_memory_) 26 if (!shared_memory_)
27 return false; 27 return false;
28 28
29 // map the header into our process so we can see how long the rest is, 29 // map the header into our process so we can see how long the rest is,
30 // and set the salt 30 // and set the salt
31 if (!shared_memory_->Map(sizeof(SharedHeader))) 31 if (!shared_memory_->Map(sizeof(SharedHeader)))
32 return false; 32 return false;
33 SharedHeader* header = 33 SharedHeader* header =
34 static_cast<SharedHeader*>(shared_memory_->memory()); 34 static_cast<SharedHeader*>(shared_memory_->memory());
35 DCHECK(header); 35 DCHECK(header);
(...skipping 18 matching lines...) Expand all
54 54
55 void VisitedLinkSlave::FreeTable() { 55 void VisitedLinkSlave::FreeTable() {
56 if (shared_memory_ ) { 56 if (shared_memory_ ) {
57 delete shared_memory_; 57 delete shared_memory_;
58 shared_memory_ = NULL; 58 shared_memory_ = NULL;
59 } 59 }
60 hash_table_ = NULL; 60 hash_table_ = NULL;
61 table_length_ = 0; 61 table_length_ = 0;
62 } 62 }
63 63
OLDNEW
« no previous file with comments | « chrome/renderer/visitedlink_slave.h ('k') | chrome/renderer/webplugin_delegate_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698