Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Side by Side Diff: content/renderer/service_worker/embedded_worker_dispatcher.h

Issue 1908313003: Shows the error message while fetching the SW script in the DevTools console. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: incorporated falken's comment Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_DISPATCHER_H_ 5 #ifndef CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_DISPATCHER_H_
6 #define CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_DISPATCHER_H_ 6 #define CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_DISPATCHER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/id_map.h" 10 #include "base/id_map.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "content/public/common/console_message_level.h"
14 #include "ipc/ipc_listener.h" 15 #include "ipc/ipc_listener.h"
15 16
16 struct EmbeddedWorkerMsg_StartWorker_Params; 17 struct EmbeddedWorkerMsg_StartWorker_Params;
17 class GURL; 18 class GURL;
18 19
19 namespace content { 20 namespace content {
20 21
21 // A tiny dispatcher which handles embedded worker start/stop messages. 22 // A tiny dispatcher which handles embedded worker start/stop messages.
22 class EmbeddedWorkerDispatcher : public IPC::Listener { 23 class EmbeddedWorkerDispatcher : public IPC::Listener {
23 public: 24 public:
24 EmbeddedWorkerDispatcher(); 25 EmbeddedWorkerDispatcher();
25 ~EmbeddedWorkerDispatcher() override; 26 ~EmbeddedWorkerDispatcher() override;
26 27
27 // IPC::Listener overrides. 28 // IPC::Listener overrides.
28 bool OnMessageReceived(const IPC::Message& message) override; 29 bool OnMessageReceived(const IPC::Message& message) override;
29 30
30 void WorkerContextDestroyed(int embedded_worker_id); 31 void WorkerContextDestroyed(int embedded_worker_id);
31 32
32 private: 33 private:
33 class WorkerWrapper; 34 class WorkerWrapper;
34 35
35 void OnStartWorker(const EmbeddedWorkerMsg_StartWorker_Params& params); 36 void OnStartWorker(const EmbeddedWorkerMsg_StartWorker_Params& params);
36 void OnStopWorker(int embedded_worker_id); 37 void OnStopWorker(int embedded_worker_id);
37 void OnResumeAfterDownload(int embedded_worker_id); 38 void OnResumeAfterDownload(int embedded_worker_id);
39 void OnAddMessageToConsole(int embedded_worker_id,
40 ConsoleMessageLevel level,
41 const std::string& message);
38 42
39 IDMap<WorkerWrapper, IDMapOwnPointer> workers_; 43 IDMap<WorkerWrapper, IDMapOwnPointer> workers_;
40 std::map<int /* embedded_worker_id */, base::TimeTicks> stop_worker_times_; 44 std::map<int /* embedded_worker_id */, base::TimeTicks> stop_worker_times_;
41 base::WeakPtrFactory<EmbeddedWorkerDispatcher> weak_factory_; 45 base::WeakPtrFactory<EmbeddedWorkerDispatcher> weak_factory_;
42 46
43 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerDispatcher); 47 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerDispatcher);
44 }; 48 };
45 49
46 } // namespace content 50 } // namespace content
47 51
48 #endif // CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_DISPATCHER_H_ 52 #endif // CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698