| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 CHROME_UTILITY_UTILITY_THREAD_H_ | 5 #ifndef CHROME_UTILITY_UTILITY_THREAD_H_ |
| 6 #define CHROME_UTILITY_UTILITY_THREAD_H_ | 6 #define CHROME_UTILITY_UTILITY_THREAD_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/thread.h" |
| 10 #include "chrome/common/child_thread.h" | 11 #include "chrome/common/child_thread.h" |
| 11 | 12 |
| 12 class GURL; | 13 class GURL; |
| 13 | 14 |
| 14 // This class represents the background thread where the utility task runs. | 15 // This class represents the background thread where the utility task runs. |
| 15 class UtilityThread : public ChildThread { | 16 class UtilityThread : public ChildThread { |
| 16 public: | 17 public: |
| 17 UtilityThread(); | 18 UtilityThread(); |
| 18 ~UtilityThread(); | 19 ~UtilityThread(); |
| 19 | 20 |
| 20 // Returns the one utility thread. | 21 // Returns the one utility thread. |
| 21 static UtilityThread* current() { | 22 static UtilityThread* current() { |
| 22 return static_cast<UtilityThread*>(ChildThread::current()); | 23 return static_cast<UtilityThread*>(ChildThread::current()); |
| 23 } | 24 } |
| 24 | 25 |
| 25 private: | 26 private: |
| 26 // IPC messages | 27 // IPC messages |
| 27 virtual void OnControlMessageReceived(const IPC::Message& msg); | 28 virtual void OnControlMessageReceived(const IPC::Message& msg); |
| 28 void OnUnpackExtension(const FilePath& extension_path); | 29 void OnUnpackExtension(const FilePath& extension_path); |
| 29 | 30 |
| 30 // IPC messages for web resource service. | 31 // IPC messages for web resource service. |
| 31 void OnUnpackWebResource(const std::string& resource_data); | 32 void OnUnpackWebResource(const std::string& resource_data); |
| 32 | 33 |
| 34 // Called by the thread base class |
| 35 virtual void Init(); |
| 36 virtual void CleanUp(); |
| 37 |
| 33 DISALLOW_COPY_AND_ASSIGN(UtilityThread); | 38 DISALLOW_COPY_AND_ASSIGN(UtilityThread); |
| 34 }; | 39 }; |
| 35 | 40 |
| 36 #endif // CHROME_UTILITY_UTILITY_THREAD_H_ | 41 #endif // CHROME_UTILITY_UTILITY_THREAD_H_ |
| OLD | NEW |