Updating trunk VERSION from 879.0 to 880.0
[chromium-blink-merge.git] / content / utility / utility_thread.h
blob18605d8173dfe6437825083625872b21d4fb0551
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_UTILITY_UTILITY_THREAD_H_
6 #define CONTENT_UTILITY_UTILITY_THREAD_H_
7 #pragma once
9 #include <string>
10 #include <vector>
12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h"
14 #include "base/string16.h"
15 #include "content/common/child_thread.h"
17 class IndexedDBKey;
18 class SerializedScriptValue;
20 namespace webkit_glue {
21 class WebKitPlatformSupportImpl;
24 // This class represents the background thread where the utility task runs.
25 class UtilityThread : public ChildThread {
26 public:
27 UtilityThread();
28 virtual ~UtilityThread();
30 // Releases the process if we are not (or no longer) in batch mode.
31 void ReleaseProcessIfNeeded();
33 // Returns the one utility thread.
34 static UtilityThread* current() {
35 return static_cast<UtilityThread*>(ChildThread::current());
38 private:
39 // ChildThread implementation.
40 virtual bool OnControlMessageReceived(const IPC::Message& msg) OVERRIDE;
42 // IPC message handlers.
43 void OnIDBKeysFromValuesAndKeyPath(
44 int id,
45 const std::vector<SerializedScriptValue>& serialized_script_values,
46 const string16& idb_key_path);
47 void OnInjectIDBKey(const IndexedDBKey& key,
48 const SerializedScriptValue& value,
49 const string16& key_path);
50 void OnBatchModeStarted();
51 void OnBatchModeFinished();
53 // True when we're running in batch mode.
54 bool batch_mode_;
56 scoped_ptr<webkit_glue::WebKitPlatformSupportImpl> webkit_platform_support_;
58 DISALLOW_COPY_AND_ASSIGN(UtilityThread);
61 #endif // CONTENT_UTILITY_UTILITY_THREAD_H_