| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_COMMON_GPU_GPU_CHANNEL_H_ | 5 #ifndef CONTENT_COMMON_GPU_GPU_CHANNEL_H_ | 
| 6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_H_ | 6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_H_ | 
| 7 | 7 | 
| 8 #include <string> | 8 #include <string> | 
| 9 | 9 | 
| 10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" | 
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 108 | 108 | 
| 109   // Requeue the message that is currently being processed to the beginning of | 109   // Requeue the message that is currently being processed to the beginning of | 
| 110   // the queue. Used when the processing of a message gets aborted because of | 110   // the queue. Used when the processing of a message gets aborted because of | 
| 111   // unscheduling conditions. | 111   // unscheduling conditions. | 
| 112   void RequeueMessage(); | 112   void RequeueMessage(); | 
| 113 | 113 | 
| 114   // SubscriptionRefSet::Observer implementation | 114   // SubscriptionRefSet::Observer implementation | 
| 115   void OnAddSubscription(unsigned int target) override; | 115   void OnAddSubscription(unsigned int target) override; | 
| 116   void OnRemoveSubscription(unsigned int target) override; | 116   void OnRemoveSubscription(unsigned int target) override; | 
| 117 | 117 | 
|  | 118   // Add callback when a specific order number has been processed. | 
|  | 119   void AddProcessedOrderNumberCallback(uint32_t order_number, | 
|  | 120                                        const base::Closure& callback); | 
|  | 121 | 
| 118   // This is called when a command buffer transitions from the unscheduled | 122   // This is called when a command buffer transitions from the unscheduled | 
| 119   // state to the scheduled state, which potentially means the channel | 123   // state to the scheduled state, which potentially means the channel | 
| 120   // transitions from the unscheduled to the scheduled state. When this occurs | 124   // transitions from the unscheduled to the scheduled state. When this occurs | 
| 121   // deferred IPC messaged are handled. | 125   // deferred IPC messaged are handled. | 
| 122   void OnScheduled(); | 126   void OnScheduled(); | 
| 123 | 127 | 
| 124   // This is called when a command buffer transitions between scheduled and | 128   // This is called when a command buffer transitions between scheduled and | 
| 125   // descheduled states. When any stub is descheduled, we stop preempting | 129   // descheduled states. When any stub is descheduled, we stop preempting | 
| 126   // other channels. | 130   // other channels. | 
| 127   void StubSchedulingChanged(bool scheduled); | 131   void StubSchedulingChanged(bool scheduled); | 
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 203     void RemoveRoute(int32 route_id); | 207     void RemoveRoute(int32 route_id); | 
| 204     bool HasRoute(int32 route_id) const; | 208     bool HasRoute(int32 route_id) const; | 
| 205     bool HasRoutes() const; | 209     bool HasRoutes() const; | 
| 206 | 210 | 
| 207    private: | 211    private: | 
| 208     int32 id_; | 212     int32 id_; | 
| 209     GpuStreamPriority priority_; | 213     GpuStreamPriority priority_; | 
| 210     base::hash_set<int32> routes_; | 214     base::hash_set<int32> routes_; | 
| 211   }; | 215   }; | 
| 212 | 216 | 
|  | 217   struct OrderCallback { | 
|  | 218     uint32_t order_number; | 
|  | 219     base::Closure callback_closure; | 
|  | 220 | 
|  | 221     OrderCallback(uint32_t order_num, const base::Closure& callback); | 
|  | 222     ~OrderCallback(); | 
|  | 223 | 
|  | 224     bool operator>(const OrderCallback& rhs) const { | 
|  | 225       return order_number > rhs.order_number; | 
|  | 226     } | 
|  | 227   }; | 
|  | 228   typedef std::priority_queue<OrderCallback, | 
|  | 229                               std::vector<OrderCallback>, | 
|  | 230                               std::greater<OrderCallback>> OrderCallbackQueue; | 
|  | 231 | 
| 213   friend class GpuChannelMessageFilter; | 232   friend class GpuChannelMessageFilter; | 
| 214   friend class GpuChannelMessageQueue; | 233   friend class GpuChannelMessageQueue; | 
| 215 | 234 | 
| 216   void OnDestroy(); | 235   void OnDestroy(); | 
| 217 | 236 | 
| 218   bool OnControlMessageReceived(const IPC::Message& msg); | 237   bool OnControlMessageReceived(const IPC::Message& msg); | 
| 219 | 238 | 
| 220   void HandleMessage(); | 239   void HandleMessage(); | 
| 221 | 240 | 
| 222   // Message handlers. | 241   // Message handlers. | 
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 284   uint32_t current_order_num_; | 303   uint32_t current_order_num_; | 
| 285 | 304 | 
| 286   // Last finished IPC order number. | 305   // Last finished IPC order number. | 
| 287   uint32_t processed_order_num_; | 306   uint32_t processed_order_num_; | 
| 288 | 307 | 
| 289   size_t num_stubs_descheduled_; | 308   size_t num_stubs_descheduled_; | 
| 290 | 309 | 
| 291   // Map of stream id to stream state. | 310   // Map of stream id to stream state. | 
| 292   base::hash_map<int32, StreamState> streams_; | 311   base::hash_map<int32, StreamState> streams_; | 
| 293 | 312 | 
|  | 313   // Callbacks as each order number is processed. | 
|  | 314   OrderCallbackQueue processed_order_callbacks_; | 
|  | 315 | 
| 294   bool allow_future_sync_points_; | 316   bool allow_future_sync_points_; | 
| 295   bool allow_real_time_streams_; | 317   bool allow_real_time_streams_; | 
| 296 | 318 | 
| 297   // Member variables should appear before the WeakPtrFactory, to ensure | 319   // Member variables should appear before the WeakPtrFactory, to ensure | 
| 298   // that any WeakPtrs to Controller are invalidated before its members | 320   // that any WeakPtrs to Controller are invalidated before its members | 
| 299   // variable's destructors are executed, rendering them invalid. | 321   // variable's destructors are executed, rendering them invalid. | 
| 300   base::WeakPtrFactory<GpuChannel> weak_factory_; | 322   base::WeakPtrFactory<GpuChannel> weak_factory_; | 
| 301 | 323 | 
| 302   DISALLOW_COPY_AND_ASSIGN(GpuChannel); | 324   DISALLOW_COPY_AND_ASSIGN(GpuChannel); | 
| 303 }; | 325 }; | 
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 393   // True if this channel can create future sync points. | 415   // True if this channel can create future sync points. | 
| 394   bool future_sync_points_; | 416   bool future_sync_points_; | 
| 395 | 417 | 
| 396   // This number is only ever incremented/read on the IO thread. | 418   // This number is only ever incremented/read on the IO thread. | 
| 397   static uint32_t global_order_counter_; | 419   static uint32_t global_order_counter_; | 
| 398 }; | 420 }; | 
| 399 | 421 | 
| 400 }  // namespace content | 422 }  // namespace content | 
| 401 | 423 | 
| 402 #endif  // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ | 424 #endif  // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ | 
| OLD | NEW | 
|---|