OLD | NEW |
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 "content/browser/service_worker/service_worker_version.h" | 5 #include "content/browser/service_worker/service_worker_version.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 // Schedule calling this method after starting the worker. | 638 // Schedule calling this method after starting the worker. |
639 StartWorker(base::Bind( | 639 StartWorker(base::Bind( |
640 &RunTaskAfterStartWorker, weak_factory_.GetWeakPtr(), | 640 &RunTaskAfterStartWorker, weak_factory_.GetWeakPtr(), |
641 base::Bind(&RunErrorMessageCallback, sent_message_ports, callback), | 641 base::Bind(&RunErrorMessageCallback, sent_message_ports, callback), |
642 base::Bind(&self::DispatchMessageEventInternal, | 642 base::Bind(&self::DispatchMessageEventInternal, |
643 weak_factory_.GetWeakPtr(), message, sent_message_ports, | 643 weak_factory_.GetWeakPtr(), message, sent_message_ports, |
644 callback))); | 644 callback))); |
645 return; | 645 return; |
646 } | 646 } |
647 | 647 |
| 648 // TODO(kinuko): Cleanup this (and corresponding unit test) when message |
| 649 // event becomes extendable, round-trip event. (crbug.com/498596) |
| 650 RestartTick(&idle_time_); |
| 651 |
648 MessagePortMessageFilter* filter = | 652 MessagePortMessageFilter* filter = |
649 embedded_worker_->message_port_message_filter(); | 653 embedded_worker_->message_port_message_filter(); |
650 std::vector<int> new_routing_ids; | 654 std::vector<int> new_routing_ids; |
651 filter->UpdateMessagePortsWithNewRoutes(sent_message_ports, &new_routing_ids); | 655 filter->UpdateMessagePortsWithNewRoutes(sent_message_ports, &new_routing_ids); |
652 ServiceWorkerStatusCode status = | 656 ServiceWorkerStatusCode status = |
653 embedded_worker_->SendMessage(ServiceWorkerMsg_MessageToWorker( | 657 embedded_worker_->SendMessage(ServiceWorkerMsg_MessageToWorker( |
654 message, sent_message_ports, new_routing_ids)); | 658 message, sent_message_ports, new_routing_ids)); |
655 RunSoon(base::Bind(callback, status)); | 659 RunSoon(base::Bind(callback, status)); |
656 } | 660 } |
657 | 661 |
(...skipping 1377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2035 return SERVICE_WORKER_ERROR_ABORT; | 2039 return SERVICE_WORKER_ERROR_ABORT; |
2036 default: | 2040 default: |
2037 return SERVICE_WORKER_ERROR_NETWORK; | 2041 return SERVICE_WORKER_ERROR_NETWORK; |
2038 } | 2042 } |
2039 } | 2043 } |
2040 | 2044 |
2041 return default_code; | 2045 return default_code; |
2042 } | 2046 } |
2043 | 2047 |
2044 } // namespace content | 2048 } // namespace content |
OLD | NEW |