Bug 1066410 - Serious color distortion happened when plays WebRTC. r=jesup, a=bajaj
[gecko.git] / dom / workers / WorkerFeature.h
blob4542e856257c93842ece4e91f5703c7fa7388a33
1 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef mozilla_dom_workers_workerfeature_h__
7 #define mozilla_dom_workers_workerfeature_h__
9 #include "mozilla/dom/workers/Workers.h"
11 BEGIN_WORKERS_NAMESPACE
13 /**
14 * Use this chart to help figure out behavior during each of the closing
15 * statuses. Details below.
17 * +==============================================================+
18 * | Closing Statuses |
19 * +=============+=============+=================+================+
20 * | status | clear queue | abort execution | close handler |
21 * +=============+=============+=================+================+
22 * | Closing | yes | no | no timeout |
23 * +-------------+-------------+-----------------+----------------+
24 * | Terminating | yes | yes | no timeout |
25 * +-------------+-------------+-----------------+----------------+
26 * | Canceling | yes | yes | short duration |
27 * +-------------+-------------+-----------------+----------------+
28 * | Killing | yes | yes | doesn't run |
29 * +-------------+-------------+-----------------+----------------+
32 #ifdef Status
33 /* Xlib headers insist on this for some reason... Nuke it because
34 it'll override our member name */
35 #undef Status
36 #endif
37 enum Status
39 // Not yet scheduled.
40 Pending = 0,
42 // This status means that the close handler has not yet been scheduled.
43 Running,
45 // Inner script called close() on the worker global scope. Setting this
46 // status causes the worker to clear its queue of events but does not abort
47 // the currently running script. The close handler is also scheduled with
48 // no expiration time.
49 Closing,
51 // Outer script called terminate() on the worker or the worker object was
52 // garbage collected in its outer script. Setting this status causes the
53 // worker to abort immediately, clear its queue of events, and schedules the
54 // close handler with no expiration time.
55 Terminating,
57 // Either the user navigated away from the owning page or the owning page fell
58 // out of bfcache. Setting this status causes the worker to abort immediately
59 // and schedules the close handler with a short expiration time. Since the
60 // page has gone away the worker may not post any messages.
61 Canceling,
63 // The application is shutting down. Setting this status causes the worker to
64 // abort immediately and the close handler is never scheduled.
65 Killing,
67 // The close handler has run and the worker is effectively dead.
68 Dead
71 class WorkerFeature
73 public:
74 virtual ~WorkerFeature() { }
76 virtual bool Suspend(JSContext* aCx) { return true; }
77 virtual bool Resume(JSContext* aCx) { return true; }
79 virtual bool Notify(JSContext* aCx, Status aStatus) = 0;
82 END_WORKERS_NAMESPACE
84 #endif /* mozilla_dom_workers_workerfeature_h__ */