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

Side by Side Diff: chrome/renderer/greasemonkey_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/greasemonkey_slave.h ('k') | chrome/renderer/greasemonkey_slave_unittest.cc » ('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) 2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/greasemonkey_slave.h" 5 #include "chrome/renderer/greasemonkey_slave.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/pickle.h" 8 #include "base/pickle.h"
9 #include "base/shared_memory.h" 9 #include "base/shared_memory.h"
10 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 } 106 }
107 107
108 return output_pattern; 108 return output_pattern;
109 } 109 }
110 110
111 111
112 // GreasemonkeySlave 112 // GreasemonkeySlave
113 GreasemonkeySlave::GreasemonkeySlave() : shared_memory_(NULL) { 113 GreasemonkeySlave::GreasemonkeySlave() : shared_memory_(NULL) {
114 } 114 }
115 115
116 bool GreasemonkeySlave::UpdateScripts(SharedMemoryHandle shared_memory) { 116 bool GreasemonkeySlave::UpdateScripts(base::SharedMemoryHandle shared_memory) {
117 scripts_.clear(); 117 scripts_.clear();
118 118
119 // Create the shared memory object. 119 // Create the shared memory object (read only).
120 shared_memory_.reset(new SharedMemory(shared_memory, true)); // read-only 120 shared_memory_.reset(new base::SharedMemory(shared_memory, true));
121 if (!shared_memory_.get()) 121 if (!shared_memory_.get())
122 return false; 122 return false;
123 123
124 // First get the size of the memory block. 124 // First get the size of the memory block.
125 if (!shared_memory_->Map(sizeof(Pickle::Header))) 125 if (!shared_memory_->Map(sizeof(Pickle::Header)))
126 return false; 126 return false;
127 Pickle::Header* pickle_header = 127 Pickle::Header* pickle_header =
128 reinterpret_cast<Pickle::Header*>(shared_memory_->memory()); 128 reinterpret_cast<Pickle::Header*>(shared_memory_->memory());
129 129
130 // Now map in the rest of the block. 130 // Now map in the rest of the block.
(...skipping 30 matching lines...) Expand all
161 for (std::vector<GreasemonkeyScript>::iterator script = scripts_.begin(); 161 for (std::vector<GreasemonkeyScript>::iterator script = scripts_.begin();
162 script != scripts_.end(); ++script) { 162 script != scripts_.end(); ++script) {
163 if (script->MatchesUrl(frame->GetURL())) { 163 if (script->MatchesUrl(frame->GetURL())) {
164 frame->ExecuteJavaScript(script->GetBody().as_string(), 164 frame->ExecuteJavaScript(script->GetBody().as_string(),
165 script->GetURL().as_string()); 165 script->GetURL().as_string());
166 } 166 }
167 } 167 }
168 168
169 return true; 169 return true;
170 } 170 }
OLDNEW
« no previous file with comments | « chrome/renderer/greasemonkey_slave.h ('k') | chrome/renderer/greasemonkey_slave_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698