| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 // onNavigationPreloadError() will be called. | 283 // onNavigationPreloadError() will be called. |
| 284 pending_preload_fetch_events_.insert(fetch_event_id, fetch_event); | 284 pending_preload_fetch_events_.insert(fetch_event_id, fetch_event); |
| 285 } | 285 } |
| 286 wait_until_observer->WillDispatchEvent(); | 286 wait_until_observer->WillDispatchEvent(); |
| 287 respond_with_observer->WillDispatchEvent(); | 287 respond_with_observer->WillDispatchEvent(); |
| 288 DispatchEventResult dispatch_result = | 288 DispatchEventResult dispatch_result = |
| 289 WorkerGlobalScope()->DispatchEvent(fetch_event); | 289 WorkerGlobalScope()->DispatchEvent(fetch_event); |
| 290 respond_with_observer->DidDispatchEvent(dispatch_result); | 290 respond_with_observer->DidDispatchEvent(dispatch_result); |
| 291 // false is okay because waitUntil for fetch event doesn't care about the | 291 // false is okay because waitUntil for fetch event doesn't care about the |
| 292 // promise rejection or an uncaught runtime script error. | 292 // promise rejection or an uncaught runtime script error. |
| 293 wait_until_observer->DidDispatchEvent(false /* errorOccurred */); | 293 wait_until_observer->DidDispatchEvent(false /* event_dispatch_failed */); |
| 294 } | 294 } |
| 295 | 295 |
| 296 void ServiceWorkerGlobalScopeProxy::OnNavigationPreloadResponse( | 296 void ServiceWorkerGlobalScopeProxy::OnNavigationPreloadResponse( |
| 297 int fetch_event_id, | 297 int fetch_event_id, |
| 298 std::unique_ptr<WebURLResponse> response, | 298 std::unique_ptr<WebURLResponse> response, |
| 299 std::unique_ptr<WebDataConsumerHandle> data_consume_handle) { | 299 std::unique_ptr<WebDataConsumerHandle> data_consume_handle) { |
| 300 auto it = pending_preload_fetch_events_.find(fetch_event_id); | 300 auto it = pending_preload_fetch_events_.find(fetch_event_id); |
| 301 DCHECK(it != pending_preload_fetch_events_.end()); | 301 DCHECK(it != pending_preload_fetch_events_.end()); |
| 302 FetchEvent* fetch_event = it->value.Get(); | 302 FetchEvent* fetch_event = it->value.Get(); |
| 303 DCHECK(fetch_event); | 303 DCHECK(fetch_event); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 WorkerGlobalScope()->ScriptController()->GetScriptState(), | 376 WorkerGlobalScope()->ScriptController()->GetScriptState(), |
| 377 EventTypeNames::foreignfetch, event_init, respond_with_observer, | 377 EventTypeNames::foreignfetch, event_init, respond_with_observer, |
| 378 wait_until_observer); | 378 wait_until_observer); |
| 379 wait_until_observer->WillDispatchEvent(); | 379 wait_until_observer->WillDispatchEvent(); |
| 380 respond_with_observer->WillDispatchEvent(); | 380 respond_with_observer->WillDispatchEvent(); |
| 381 DispatchEventResult dispatch_result = | 381 DispatchEventResult dispatch_result = |
| 382 WorkerGlobalScope()->DispatchEvent(fetch_event); | 382 WorkerGlobalScope()->DispatchEvent(fetch_event); |
| 383 respond_with_observer->DidDispatchEvent(dispatch_result); | 383 respond_with_observer->DidDispatchEvent(dispatch_result); |
| 384 // false is okay because waitUntil for foreign fetch event doesn't care | 384 // false is okay because waitUntil for foreign fetch event doesn't care |
| 385 // about the promise rejection or an uncaught runtime script error. | 385 // about the promise rejection or an uncaught runtime script error. |
| 386 wait_until_observer->DidDispatchEvent(false /* errorOccurred */); | 386 wait_until_observer->DidDispatchEvent(false /* event_dispatch_failed */); |
| 387 } | 387 } |
| 388 | 388 |
| 389 void ServiceWorkerGlobalScopeProxy::DispatchInstallEvent(int event_id) { | 389 void ServiceWorkerGlobalScopeProxy::DispatchInstallEvent(int event_id) { |
| 390 WaitUntilObserver* observer = WaitUntilObserver::Create( | 390 WaitUntilObserver* observer = WaitUntilObserver::Create( |
| 391 WorkerGlobalScope(), WaitUntilObserver::kInstall, event_id); | 391 WorkerGlobalScope(), WaitUntilObserver::kInstall, event_id); |
| 392 Event* event = InstallEvent::Create( | 392 Event* event = InstallEvent::Create( |
| 393 EventTypeNames::install, ExtendableEventInit(), event_id, observer); | 393 EventTypeNames::install, ExtendableEventInit(), event_id, observer); |
| 394 WorkerGlobalScope()->DispatchExtendableEvent(event, observer); | 394 WorkerGlobalScope()->DispatchExtendableEvent(event, observer); |
| 395 } | 395 } |
| 396 | 396 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 web_app_request), | 470 web_app_request), |
| 471 respond_with_observer, wait_until_observer); | 471 respond_with_observer, wait_until_observer); |
| 472 | 472 |
| 473 wait_until_observer->WillDispatchEvent(); | 473 wait_until_observer->WillDispatchEvent(); |
| 474 respond_with_observer->WillDispatchEvent(); | 474 respond_with_observer->WillDispatchEvent(); |
| 475 DispatchEventResult dispatch_result = | 475 DispatchEventResult dispatch_result = |
| 476 WorkerGlobalScope()->DispatchEvent(event); | 476 WorkerGlobalScope()->DispatchEvent(event); |
| 477 respond_with_observer->DidDispatchEvent(dispatch_result); | 477 respond_with_observer->DidDispatchEvent(dispatch_result); |
| 478 // false is okay because waitUntil for payment request event doesn't care | 478 // false is okay because waitUntil for payment request event doesn't care |
| 479 // about the promise rejection or an uncaught runtime script error. | 479 // about the promise rejection or an uncaught runtime script error. |
| 480 wait_until_observer->DidDispatchEvent(false /* errorOccurred */); | 480 wait_until_observer->DidDispatchEvent(false /* event_dispatch_failed */); |
| 481 } | 481 } |
| 482 | 482 |
| 483 bool ServiceWorkerGlobalScopeProxy::HasFetchEventHandler() { | 483 bool ServiceWorkerGlobalScopeProxy::HasFetchEventHandler() { |
| 484 DCHECK(worker_global_scope_); | 484 DCHECK(worker_global_scope_); |
| 485 return worker_global_scope_->HasEventListeners(EventTypeNames::fetch); | 485 return worker_global_scope_->HasEventListeners(EventTypeNames::fetch); |
| 486 } | 486 } |
| 487 | 487 |
| 488 void ServiceWorkerGlobalScopeProxy::CountFeature(UseCounter::Feature feature) { | 488 void ServiceWorkerGlobalScopeProxy::CountFeature(UseCounter::Feature feature) { |
| 489 Client().CountFeature(static_cast<uint32_t>(feature)); | 489 Client().CountFeature(static_cast<uint32_t>(feature)); |
| 490 } | 490 } |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 return *document_; | 612 return *document_; |
| 613 } | 613 } |
| 614 | 614 |
| 615 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::WorkerGlobalScope() | 615 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::WorkerGlobalScope() |
| 616 const { | 616 const { |
| 617 DCHECK(worker_global_scope_); | 617 DCHECK(worker_global_scope_); |
| 618 return worker_global_scope_; | 618 return worker_global_scope_; |
| 619 } | 619 } |
| 620 | 620 |
| 621 } // namespace blink | 621 } // namespace blink |
| OLD | NEW |