Chromium Code Reviews| 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 22 matching lines...) Expand all Loading... | |
| 33 | 33 |
| 34 #include "WebWorkerPermissionClientProxy.h" | 34 #include "WebWorkerPermissionClientProxy.h" |
| 35 | 35 |
| 36 namespace blink { | 36 namespace blink { |
| 37 | 37 |
| 38 class WebString; | 38 class WebString; |
| 39 class WebServiceWorkerContextProxy; | 39 class WebServiceWorkerContextProxy; |
| 40 | 40 |
| 41 // This interface is implemented by the client. It is suppoed to be created | 41 // This interface is implemented by the client. It is suppoed to be created |
| 42 // on the main thread and then passed on to the worker thread to be owned | 42 // on the main thread and then passed on to the worker thread to be owned |
| 43 // by a newly created WorkerGlobalScope. All methods of this class are | 43 // by a newly created WorkerGlobalScope. Once workerContextStarted is called |
| 44 // called on the worker thread. | 44 // (and this should be called first in the normal case) all methods of this |
|
michaeln
2013/11/21 02:00:40
The contract for these callbacks is squishy. It mi
kinuko
2013/11/21 06:36:05
Sounds good, done.
| |
| 45 // class are called on the worker thread. | |
| 45 class WebServiceWorkerContextClient { | 46 class WebServiceWorkerContextClient { |
| 46 public: | 47 public: |
| 48 virtual ~WebServiceWorkerContextClient() { } | |
| 49 | |
| 47 // A new WorkerGlobalScope is created and started to run on the | 50 // A new WorkerGlobalScope is created and started to run on the |
| 48 // worker thread. | 51 // worker thread. |
| 49 // This also gives back a proxy to the client to talk to the | 52 // This also gives back a proxy to the client to talk to the |
| 50 // newly created WorkerGlobalScope. The proxy is held by WorkerGlobalScope | 53 // newly created WorkerGlobalScope. The proxy is held by WorkerGlobalScope |
| 51 // and should not be held by the caller. No proxy methods should be called | 54 // and should not be held by the caller. No proxy methods should be called |
| 52 // after workerContextDestroyed() is called. | 55 // after workerContextDestroyed() is called. |
| 53 virtual void workerContextStarted(WebServiceWorkerContextProxy*) { } | 56 virtual void workerContextStarted(WebServiceWorkerContextProxy*) { } |
| 54 | 57 |
| 55 // WorkerGlobalScope.close() is called. | 58 // WorkerGlobalScope.close() is called. |
| 56 virtual void workerContextClosed() { } | 59 virtual void workerContextClosed() { } |
| 57 | 60 |
| 58 // WorkerGlobalScope is destroyed. The client should clear the | 61 // WorkerGlobalScope is destroyed. The client should clear the |
| 59 // WebServiceWorkerGlobalScopeProxy when this is called. | 62 // WebServiceWorkerGlobalScopeProxy when this is called. |
| 63 // This may be called on the main thread before WorkerContextStarted is | |
| 64 // called if the worker context is asked to terminate before loading the | |
| 65 // script finishes. | |
| 60 virtual void workerContextDestroyed() { } | 66 virtual void workerContextDestroyed() { } |
| 61 | 67 |
| 68 // Loading WorkerGlobalScope is failed. This is called on the main thread | |
| 69 // before WorkerContextStarted is called if loading the script fails. | |
| 70 virtual void workerContextLoadFailed() { } | |
| 71 | |
| 62 virtual void dispatchDevToolsMessage(const WebString&) { } | 72 virtual void dispatchDevToolsMessage(const WebString&) { } |
| 63 virtual void saveDevToolsAgentState(const WebString&) { } | 73 virtual void saveDevToolsAgentState(const WebString&) { } |
| 64 }; | 74 }; |
| 65 | 75 |
| 66 } // namespace blink | 76 } // namespace blink |
| 67 | 77 |
| 68 #endif // WebWorkerContextClient_h | 78 #endif // WebWorkerContextClient_h |
| OLD | NEW |