OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014, Opera Software ASA. All rights reserved. | 2 * Copyright (c) 2014, Opera Software ASA. 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 SharedWorkerPerformance::~SharedWorkerPerformance() | 46 SharedWorkerPerformance::~SharedWorkerPerformance() |
47 { | 47 { |
48 } | 48 } |
49 | 49 |
50 const char* SharedWorkerPerformance::supplementName() | 50 const char* SharedWorkerPerformance::supplementName() |
51 { | 51 { |
52 return "SharedWorkerPerformance"; | 52 return "SharedWorkerPerformance"; |
53 } | 53 } |
54 | 54 |
55 SharedWorkerPerformance* SharedWorkerPerformance::from(SharedWorker* sharedWorke
r) | 55 SharedWorkerPerformance& SharedWorkerPerformance::from(SharedWorker& sharedWorke
r) |
56 { | 56 { |
57 SharedWorkerPerformance* supplement = static_cast<SharedWorkerPerformance*>(
Supplement<SharedWorker>::from(sharedWorker, supplementName())); | 57 SharedWorkerPerformance* supplement = static_cast<SharedWorkerPerformance*>(
Supplement<SharedWorker>::from(sharedWorker, supplementName())); |
58 if (!supplement) { | 58 if (!supplement) { |
59 supplement = new SharedWorkerPerformance(); | 59 supplement = new SharedWorkerPerformance(); |
60 provideTo(sharedWorker, supplementName(), adoptPtr(supplement)); | 60 provideTo(sharedWorker, supplementName(), adoptPtr(supplement)); |
61 } | 61 } |
62 return supplement; | 62 return *supplement; |
63 } | 63 } |
64 | 64 |
65 double SharedWorkerPerformance::workerStart(ExecutionContext* context, SharedWor
ker* sharedWorker) | 65 double SharedWorkerPerformance::workerStart(ExecutionContext* context, SharedWor
ker& sharedWorker) |
66 { | 66 { |
67 return SharedWorkerPerformance::from(sharedWorker)->getWorkerStart(context,
sharedWorker); | 67 return SharedWorkerPerformance::from(sharedWorker).getWorkerStart(context, s
haredWorker); |
68 } | 68 } |
69 | 69 |
70 double SharedWorkerPerformance::getWorkerStart(ExecutionContext* context, Shared
Worker* sharedWorker) const | 70 double SharedWorkerPerformance::getWorkerStart(ExecutionContext* context, Shared
Worker&) const |
71 { | 71 { |
72 ASSERT(context); | 72 ASSERT(context); |
73 ASSERT(context->isDocument()); | 73 ASSERT(context->isDocument()); |
74 Document* document = toDocument(context); | 74 Document* document = toDocument(context); |
75 if (!document->loader()) | 75 if (!document->loader()) |
76 return 0; | 76 return 0; |
77 | 77 |
78 double navigationStart = document->loader()->timing()->navigationStart(); | 78 double navigationStart = document->loader()->timing()->navigationStart(); |
79 return m_timeOrigin - navigationStart; | 79 return m_timeOrigin - navigationStart; |
80 } | 80 } |
81 | 81 |
82 } // namespace WebCore | 82 } // namespace WebCore |
83 | 83 |
OLD | NEW |