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

Side by Side Diff: content/utility/utility_thread.h

Issue 6995095: Move UtilityProcessHost to content and move the message sending/dispatching to the clients. This... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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 CONTENT_UTILITY_UTILITY_THREAD_H_
6 #define CHROME_UTILITY_UTILITY_THREAD_H_ 6 #define CONTENT_UTILITY_UTILITY_THREAD_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/string16.h" 13 #include "base/string16.h"
14 #include "base/platform_file.h"
15 #include "content/common/child_thread.h" 14 #include "content/common/child_thread.h"
16 15
17 class FilePath;
18 class IndexedDBKey; 16 class IndexedDBKey;
19 class SerializedScriptValue; 17 class SerializedScriptValue;
20 18
21 namespace gfx {
22 class Rect;
23 }
24
25 namespace IPC {
26 class Message;
27 }
28
29 namespace printing {
30 struct PageRange;
31 }
32 19
33 // This class represents the background thread where the utility task runs. 20 // This class represents the background thread where the utility task runs.
34 class UtilityThread : public ChildThread { 21 class UtilityThread : public ChildThread {
35 public: 22 public:
36 UtilityThread(); 23 UtilityThread();
37 virtual ~UtilityThread(); 24 virtual ~UtilityThread();
38 25
26 // Releases the process if we are not (or no longer) in batch mode.
27 void ReleaseProcessIfNeeded();
28
39 // Returns the one utility thread. 29 // Returns the one utility thread.
40 static UtilityThread* current() { 30 static UtilityThread* current() {
41 return static_cast<UtilityThread*>(ChildThread::current()); 31 return static_cast<UtilityThread*>(ChildThread::current());
42 } 32 }
43 33
44 private: 34 private:
45 // IPC messages 35 // ChildThread implementation.
46 virtual bool OnControlMessageReceived(const IPC::Message& msg); 36 virtual bool OnControlMessageReceived(const IPC::Message& msg);
47 void OnUnpackExtension(const FilePath& extension_path);
48 37
49 // IPC messages for web resource service. 38 // IPC message handlers.
50 void OnUnpackWebResource(const std::string& resource_data);
51
52 // IPC for parsing an extensions auto-update manifest xml file.
53 void OnParseUpdateManifest(const std::string& xml);
54
55 // IPC for decoding an image.
56 void OnDecodeImage(const std::vector<unsigned char>& encoded_data);
57
58 // IPC for decoding an image which is base64 encoded.
59 void OnDecodeImageBase64(const std::string& encoded_data);
60
61 // IPC to render a PDF into a platform metafile.
62 void OnRenderPDFPagesToMetafile(
63 base::PlatformFile pdf_file,
64 const FilePath& metafile_path,
65 const gfx::Rect& render_area,
66 int render_dpi,
67 const std::vector<printing::PageRange>& page_ranges);
68
69 #if defined(OS_WIN)
70 // Helper method for Windows.
71 // |highest_rendered_page_number| is set to -1 on failure to render any page.
72 bool RenderPDFToWinMetafile(
73 base::PlatformFile pdf_file,
74 const FilePath& metafile_path,
75 const gfx::Rect& render_area,
76 int render_dpi,
77 const std::vector<printing::PageRange>& page_ranges,
78 int* highest_rendered_page_number);
79 #endif // defined(OS_WIN)
80
81 // IPC for extracting IDBKeys from SerializedScriptValues, used by IndexedDB.
82 void OnIDBKeysFromValuesAndKeyPath( 39 void OnIDBKeysFromValuesAndKeyPath(
83 int id, 40 int id,
84 const std::vector<SerializedScriptValue>& serialized_script_values, 41 const std::vector<SerializedScriptValue>& serialized_script_values,
85 const string16& idb_key_path); 42 const string16& idb_key_path);
86
87 // IPC for injecting an IndexedDB key into a SerializedScriptValue.
88 void OnInjectIDBKey(const IndexedDBKey& key, 43 void OnInjectIDBKey(const IndexedDBKey& key,
89 const SerializedScriptValue& value, 44 const SerializedScriptValue& value,
90 const string16& key_path); 45 const string16& key_path);
91
92 // IPC for parsing a string of JSON into a Value.
93 void OnParseJSON(const std::string& json);
94
95 // IPC to notify we'll be running in batch mode instead of quitting after
96 // any of the IPCs above, we'll only quit during OnBatchModeFinished().
97 void OnBatchModeStarted(); 46 void OnBatchModeStarted();
98
99 // IPC to notify batch mode has finished and we should now quit.
100 void OnBatchModeFinished(); 47 void OnBatchModeFinished();
101 48
102 // IPC to get capabilities and defaults for the specified
103 // printer. Used on Windows to isolate the service process from printer driver
104 // crashes by executing this in a separate process. This does not run in a
105 // sandbox.
106 void OnGetPrinterCapsAndDefaults(const std::string& printer_name);
107
108 // Releases the process if we are not (or no longer) in batch mode.
109 void ReleaseProcessIfNeeded();
110
111 // True when we're running in batch mode. 49 // True when we're running in batch mode.
112 bool batch_mode_; 50 bool batch_mode_;
113 51
114 DISALLOW_COPY_AND_ASSIGN(UtilityThread); 52 DISALLOW_COPY_AND_ASSIGN(UtilityThread);
115 }; 53 };
116 54
117 #endif // CHROME_UTILITY_UTILITY_THREAD_H_ 55 #endif // CONTENT_UTILITY_UTILITY_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698