OLD | NEW |
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/browser/greasemonkey_master.h" | 5 #include "chrome/browser/greasemonkey_master.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 172 |
173 // (Asynchronously) scan for our initial set of scripts. | 173 // (Asynchronously) scan for our initial set of scripts. |
174 StartScan(); | 174 StartScan(); |
175 } | 175 } |
176 | 176 |
177 GreasemonkeyMaster::~GreasemonkeyMaster() { | 177 GreasemonkeyMaster::~GreasemonkeyMaster() { |
178 if (script_reloader_) | 178 if (script_reloader_) |
179 script_reloader_->DisownMaster(); | 179 script_reloader_->DisownMaster(); |
180 } | 180 } |
181 | 181 |
182 bool GreasemonkeyMaster::ShareToProcess(ProcessHandle process, | |
183 SharedMemoryHandle* new_handle) { | |
184 if (shared_memory_.get()) | |
185 return shared_memory_->ShareToProcess(process, new_handle); | |
186 | |
187 NOTREACHED(); | |
188 return false; | |
189 } | |
190 | |
191 void GreasemonkeyMaster::NewScriptsAvailable(SharedMemory* handle) { | 182 void GreasemonkeyMaster::NewScriptsAvailable(SharedMemory* handle) { |
192 // Ensure handle is deleted or released. | 183 // Ensure handle is deleted or released. |
193 scoped_ptr<SharedMemory> handle_deleter(handle); | 184 scoped_ptr<SharedMemory> handle_deleter(handle); |
194 | 185 |
195 if (pending_scan_) { | 186 if (pending_scan_) { |
196 // While we were scanning, there were further changes. Don't bother | 187 // While we were scanning, there were further changes. Don't bother |
197 // notifying about these scripts and instead just immediately rescan. | 188 // notifying about these scripts and instead just immediately rescan. |
198 pending_scan_ = false; | 189 pending_scan_ = false; |
199 StartScan(); | 190 StartScan(); |
200 } else { | 191 } else { |
(...skipping 18 matching lines...) Expand all Loading... |
219 | 210 |
220 StartScan(); | 211 StartScan(); |
221 } | 212 } |
222 | 213 |
223 void GreasemonkeyMaster::StartScan() { | 214 void GreasemonkeyMaster::StartScan() { |
224 if (!script_reloader_) | 215 if (!script_reloader_) |
225 script_reloader_ = new ScriptReloader(this); | 216 script_reloader_ = new ScriptReloader(this); |
226 | 217 |
227 script_reloader_->StartScan(worker_loop_, *user_script_dir_); | 218 script_reloader_->StartScan(worker_loop_, *user_script_dir_); |
228 } | 219 } |
OLD | NEW |