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

Side by Side Diff: extensions/renderer/request_sender.h

Issue 1990173002: Fix "unused variable" warnings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « extensions/renderer/dispatcher.cc ('k') | extensions/renderer/request_sender.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_REQUEST_SENDER_H_ 5 #ifndef EXTENSIONS_RENDERER_REQUEST_SENDER_H_
6 #define EXTENSIONS_RENDERER_REQUEST_SENDER_H_ 6 #define EXTENSIONS_RENDERER_REQUEST_SENDER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/linked_ptr.h" 12 #include "base/memory/linked_ptr.h"
13 #include "v8/include/v8.h" 13 #include "v8/include/v8.h"
14 14
15 namespace base { 15 namespace base {
16 class ListValue; 16 class ListValue;
17 } 17 }
18 18
19 namespace extensions { 19 namespace extensions {
20 class Dispatcher;
21 class ScriptContext; 20 class ScriptContext;
22 21
23 struct PendingRequest; 22 struct PendingRequest;
24 23
25 // Responsible for sending requests for named extension API functions to the 24 // Responsible for sending requests for named extension API functions to the
26 // extension host and routing the responses back to the caller. 25 // extension host and routing the responses back to the caller.
27 class RequestSender { 26 class RequestSender {
28 public: 27 public:
29 // Source represents a user of RequestSender. Every request is associated with 28 // Source represents a user of RequestSender. Every request is associated with
30 // a Source object, which will be notified when the corresponding response 29 // a Source object, which will be notified when the corresponding response
(...skipping 19 matching lines...) Expand all
50 ~ScopedTabID(); 49 ~ScopedTabID();
51 50
52 private: 51 private:
53 RequestSender* const request_sender_; 52 RequestSender* const request_sender_;
54 const int tab_id_; 53 const int tab_id_;
55 const int previous_tab_id_; 54 const int previous_tab_id_;
56 55
57 DISALLOW_COPY_AND_ASSIGN(ScopedTabID); 56 DISALLOW_COPY_AND_ASSIGN(ScopedTabID);
58 }; 57 };
59 58
60 explicit RequestSender(Dispatcher* dispatcher); 59 RequestSender();
61 ~RequestSender(); 60 ~RequestSender();
62 61
63 // In order to avoid collision, all |request_id|s passed into StartRequest() 62 // In order to avoid collision, all |request_id|s passed into StartRequest()
64 // should be generated by this method. 63 // should be generated by this method.
65 int GetNextRequestId() const; 64 int GetNextRequestId() const;
66 65
67 // Makes a call to the API function |name| that is to be handled by the 66 // Makes a call to the API function |name| that is to be handled by the
68 // extension host. The response to this request will be received in 67 // extension host. The response to this request will be received in
69 // HandleResponse(). 68 // HandleResponse().
70 // TODO(koz): Remove |request_id| and generate that internally. 69 // TODO(koz): Remove |request_id| and generate that internally.
(...skipping 16 matching lines...) Expand all
87 // TODO(kalman): Do this in a generic/safe way. 86 // TODO(kalman): Do this in a generic/safe way.
88 void InvalidateSource(Source* source); 87 void InvalidateSource(Source* source);
89 88
90 private: 89 private:
91 friend class ScopedTabID; 90 friend class ScopedTabID;
92 typedef std::map<int, linked_ptr<PendingRequest> > PendingRequestMap; 91 typedef std::map<int, linked_ptr<PendingRequest> > PendingRequestMap;
93 92
94 void InsertRequest(int request_id, PendingRequest* pending_request); 93 void InsertRequest(int request_id, PendingRequest* pending_request);
95 linked_ptr<PendingRequest> RemoveRequest(int request_id); 94 linked_ptr<PendingRequest> RemoveRequest(int request_id);
96 95
97 Dispatcher* dispatcher_;
98 PendingRequestMap pending_requests_; 96 PendingRequestMap pending_requests_;
99 97
100 int source_tab_id_; // Id of the tab sending the request, or -1 if no tab. 98 int source_tab_id_; // Id of the tab sending the request, or -1 if no tab.
101 99
102 DISALLOW_COPY_AND_ASSIGN(RequestSender); 100 DISALLOW_COPY_AND_ASSIGN(RequestSender);
103 }; 101 };
104 102
105 } // namespace extensions 103 } // namespace extensions
106 104
107 #endif // EXTENSIONS_RENDERER_REQUEST_SENDER_H_ 105 #endif // EXTENSIONS_RENDERER_REQUEST_SENDER_H_
OLDNEW
« no previous file with comments | « extensions/renderer/dispatcher.cc ('k') | extensions/renderer/request_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698