| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 EXTENSIONS_RENDERER_WAKE_EVENT_PAGE_H_ | 5 #ifndef EXTENSIONS_RENDERER_WAKE_EVENT_PAGE_H_ |
| 6 #define EXTENSIONS_RENDERER_WAKE_EVENT_PAGE_H_ | 6 #define EXTENSIONS_RENDERER_WAKE_EVENT_PAGE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <unordered_map> |
| 10 | 11 |
| 11 #include "base/callback.h" | 12 #include "base/callback.h" |
| 12 #include "base/containers/scoped_ptr_hash_map.h" | |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
| 17 #include "content/public/renderer/render_thread_observer.h" | 17 #include "content/public/renderer/render_thread_observer.h" |
| 18 #include "ipc/ipc_sync_message_filter.h" | 18 #include "ipc/ipc_sync_message_filter.h" |
| 19 #include "v8/include/v8.h" | 19 #include "v8/include/v8.h" |
| 20 | 20 |
| 21 namespace content { | 21 namespace content { |
| 22 class RenderThread; | 22 class RenderThread; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 bool OnControlMessageReceived(const IPC::Message& message) override; | 96 bool OnControlMessageReceived(const IPC::Message& message) override; |
| 97 | 97 |
| 98 // OnControlMessageReceived handlers: | 98 // OnControlMessageReceived handlers: |
| 99 void OnWakeEventPageResponse(int request_id, bool success); | 99 void OnWakeEventPageResponse(int request_id, bool success); |
| 100 | 100 |
| 101 // IPC sender. Belongs to the render thread, but thread safe. | 101 // IPC sender. Belongs to the render thread, but thread safe. |
| 102 scoped_refptr<IPC::SyncMessageFilter> message_filter_; | 102 scoped_refptr<IPC::SyncMessageFilter> message_filter_; |
| 103 | 103 |
| 104 // All in-flight requests, keyed by request ID. Used on multiple threads, so | 104 // All in-flight requests, keyed by request ID. Used on multiple threads, so |
| 105 // must be guarded by |requests_lock_|. | 105 // must be guarded by |requests_lock_|. |
| 106 base::ScopedPtrHashMap<int, std::unique_ptr<RequestData>> requests_; | 106 std::unordered_map<int, std::unique_ptr<RequestData>> requests_; |
| 107 | 107 |
| 108 // Lock for |requests_|. | 108 // Lock for |requests_|. |
| 109 base::Lock requests_lock_; | 109 base::Lock requests_lock_; |
| 110 | 110 |
| 111 DISALLOW_COPY_AND_ASSIGN(WakeEventPage); | 111 DISALLOW_COPY_AND_ASSIGN(WakeEventPage); |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 } // namespace extensions | 114 } // namespace extensions |
| 115 | 115 |
| 116 #endif // EXTENSIONS_RENDERER_WAKE_EVENT_PAGE_H_ | 116 #endif // EXTENSIONS_RENDERER_WAKE_EVENT_PAGE_H_ |
| OLD | NEW |