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

Side by Side Diff: components/nacl/browser/nacl_browser.cc

Issue 286143010: Remove knowledge of nacl from content. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
« no previous file with comments | « components/nacl/browser/nacl_browser.h ('k') | components/nacl/browser/nacl_process_host.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/nacl/browser/nacl_browser.h" 5 #include "components/nacl/browser/nacl_browser.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/files/file_proxy.h" 9 #include "base/files/file_proxy.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 } else { 265 } else {
266 LOG(ERROR) << "Failed to open NaCl IRT file \"" 266 LOG(ERROR) << "Failed to open NaCl IRT file \""
267 << irt_filepath_.LossyDisplayName() 267 << irt_filepath_.LossyDisplayName()
268 << "\": " << error_code; 268 << "\": " << error_code;
269 MarkAsFailed(); 269 MarkAsFailed();
270 } 270 }
271 irt_state_ = NaClResourceReady; 271 irt_state_ = NaClResourceReady;
272 CheckWaiting(); 272 CheckWaiting();
273 } 273 }
274 274
275 void NaClBrowser::FireGdbDebugStubPortOpened(int port) { 275 void NaClBrowser::SetProcessGdbDebugStubPort(int process_id, int port) {
276 content::BrowserThread::PostTask( 276 gdb_debug_stub_port_map_[process_id] = port;
277 content::BrowserThread::IO, 277 if (port != kGdbDebugStubPortUnknown &&
278 FROM_HERE, 278 !debug_stub_port_listener_.is_null()) {
279 base::Bind(debug_stub_port_listener_, port)); 279 content::BrowserThread::PostTask(
280 } 280 content::BrowserThread::IO,
281 281 FROM_HERE,
282 bool NaClBrowser::HasGdbDebugStubPortListener() { 282 base::Bind(debug_stub_port_listener_, port));
283 return !debug_stub_port_listener_.is_null(); 283 }
284 } 284 }
285 285
286 void NaClBrowser::SetGdbDebugStubPortListener( 286 void NaClBrowser::SetGdbDebugStubPortListener(
287 base::Callback<void(int)> listener) { 287 base::Callback<void(int)> listener) {
288 debug_stub_port_listener_ = listener; 288 debug_stub_port_listener_ = listener;
289 } 289 }
290 290
291 void NaClBrowser::ClearGdbDebugStubPortListener() { 291 void NaClBrowser::ClearGdbDebugStubPortListener() {
292 debug_stub_port_listener_.Reset(); 292 debug_stub_port_listener_.Reset();
293 } 293 }
294 294
295 int NaClBrowser::GetProcessGdbDebugStubPort(int process_id) {
296 GdbDebugStubPortMap::iterator i = gdb_debug_stub_port_map_.find(process_id);
297 if (i != gdb_debug_stub_port_map_.end()) {
298 return i->second;
299 }
300 return kGdbDebugStubPortUnused;
301 }
302
295 void NaClBrowser::InitValidationCacheFilePath() { 303 void NaClBrowser::InitValidationCacheFilePath() {
296 // Determine where the validation cache resides in the file system. It 304 // Determine where the validation cache resides in the file system. It
297 // exists in Chrome's cache directory and is not tied to any specific 305 // exists in Chrome's cache directory and is not tied to any specific
298 // profile. 306 // profile.
299 // Start by finding the user data directory. 307 // Start by finding the user data directory.
300 base::FilePath user_data_dir; 308 base::FilePath user_data_dir;
301 if (!browser_delegate_->GetUserDirectory(&user_data_dir)) { 309 if (!browser_delegate_->GetUserDirectory(&user_data_dir)) {
302 RunWithoutValidationCache(); 310 RunWithoutValidationCache();
303 return; 311 return;
304 } 312 }
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 // The task is sequenced so that multiple writes happen in order. 535 // The task is sequenced so that multiple writes happen in order.
528 content::BrowserThread::PostBlockingPoolSequencedTask( 536 content::BrowserThread::PostBlockingPoolSequencedTask(
529 kValidationCacheSequenceName, 537 kValidationCacheSequenceName,
530 FROM_HERE, 538 FROM_HERE,
531 base::Bind(WriteCache, validation_cache_file_path_, 539 base::Bind(WriteCache, validation_cache_file_path_,
532 base::Owned(pickle))); 540 base::Owned(pickle)));
533 } 541 }
534 validation_cache_is_modified_ = false; 542 validation_cache_is_modified_ = false;
535 } 543 }
536 544
545 void NaClBrowser::OnProcessEnd(int process_id) {
546 gdb_debug_stub_port_map_.erase(process_id);
547 }
548
537 void NaClBrowser::OnProcessCrashed() { 549 void NaClBrowser::OnProcessCrashed() {
538 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); 550 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
539 if (crash_times_.size() == kMaxCrashesPerInterval) { 551 if (crash_times_.size() == kMaxCrashesPerInterval) {
540 crash_times_.pop_front(); 552 crash_times_.pop_front();
541 } 553 }
542 base::Time time = base::Time::Now(); 554 base::Time time = base::Time::Now();
543 crash_times_.push_back(time); 555 crash_times_.push_back(time);
544 } 556 }
545 557
546 bool NaClBrowser::IsThrottled() { 558 bool NaClBrowser::IsThrottled() {
547 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); 559 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
548 if (crash_times_.size() != kMaxCrashesPerInterval) { 560 if (crash_times_.size() != kMaxCrashesPerInterval) {
549 return false; 561 return false;
550 } 562 }
551 base::TimeDelta delta = base::Time::Now() - crash_times_.front(); 563 base::TimeDelta delta = base::Time::Now() - crash_times_.front();
552 return delta.InSeconds() <= kCrashesIntervalInSeconds; 564 return delta.InSeconds() <= kCrashesIntervalInSeconds;
553 } 565 }
554 566
555 } // namespace nacl 567 } // namespace nacl
OLDNEW
« no previous file with comments | « components/nacl/browser/nacl_browser.h ('k') | components/nacl/browser/nacl_process_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698