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

Side by Side Diff: chrome/renderer/render_process.h

Issue 155876: Revert r21117 as it caused reliability failures.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 5 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
« no previous file with comments | « chrome/renderer/mock_render_process.h ('k') | chrome/renderer/render_process.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 (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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_RENDERER_RENDER_PROCESS_H__ 5 #ifndef CHROME_RENDERER_RENDER_PROCESS_H__
6 #define CHROME_RENDERER_RENDER_PROCESS_H__ 6 #define CHROME_RENDERER_RENDER_PROCESS_H__
7 7
8 #include "base/timer.h" 8 #include "base/timer.h"
9 #include "chrome/common/child_process.h" 9 #include "chrome/common/child_process.h"
10 #include "chrome/renderer/render_thread.h" 10 #include "chrome/renderer/render_thread.h"
11 #include "skia/ext/platform_canvas.h" 11 #include "skia/ext/platform_canvas.h"
12 12
13 namespace gfx { 13 namespace gfx {
14 class Rect; 14 class Rect;
15 } 15 }
16 16
17 class TransportDIB; 17 class TransportDIB;
18 18
19 // Represents the renderer end of the browser<->renderer connection. The 19 // Represents the renderer end of the browser<->renderer connection. The
20 // opposite end is the RenderProcessHost. This is a singleton object for 20 // opposite end is the RenderProcessHost. This is a singleton object for
21 // each renderer. 21 // each renderer.
22 class RenderProcess : public ChildProcess { 22 class RenderProcess : public ChildProcess {
23 public: 23 public:
24 // This constructor grabs the channel name from the command line arguments.
24 RenderProcess(); 25 RenderProcess();
26 // This constructor uses the given channel name.
27 RenderProcess(const std::string& channel_name);
28
25 ~RenderProcess(); 29 ~RenderProcess();
26 30
27 // Get a canvas suitable for drawing and transporting to the browser 31 // Get a canvas suitable for drawing and transporting to the browser
28 // memory: (output) the transport DIB memory 32 // memory: (output) the transport DIB memory
29 // rect: the rectangle which will be painted, use for sizing the canvas 33 // rect: the rectangle which will be painted, use for sizing the canvas
30 // returns: NULL on error 34 // returns: NULL on error
31 // 35 //
32 // When no longer needed, you should pass the TransportDIB to 36 // When no longer needed, you should pass the TransportDIB to
33 // ReleaseTransportDIB so that it can be recycled. 37 // ReleaseTransportDIB so that it can be recycled.
34 skia::PlatformCanvas* GetDrawingCanvas( 38 skia::PlatformCanvas* GetDrawingCanvas(
35 TransportDIB** memory, const gfx::Rect& rect); 39 TransportDIB** memory, const gfx::Rect& rect);
36 40
37 // Frees shared memory allocated by AllocSharedMemory. You should only use 41 // Frees shared memory allocated by AllocSharedMemory. You should only use
38 // this function to free the SharedMemory object. 42 // this function to free the SharedMemory object.
39 void ReleaseTransportDIB(TransportDIB* memory); 43 void ReleaseTransportDIB(TransportDIB* memory);
40 44
41 // Returns true if plugins should be loaded in-process. 45 // Returns true if plugins should be loaded in-process.
42 bool in_process_plugins() const { return in_process_plugins_; } 46 bool in_process_plugins() const { return in_process_plugins_; }
43 47
44 bool initialized_media_library() const { return initialized_media_library_; } 48 bool initialized_media_library() const { return initialized_media_library_; }
45 49
46 // Returns a pointer to the RenderProcess singleton instance. 50 // Returns a pointer to the RenderProcess singleton instance.
47 static RenderProcess* current() { 51 static RenderProcess* current() {
48 return static_cast<RenderProcess*>(ChildProcess::current()); 52 return static_cast<RenderProcess*>(ChildProcess::current());
49 } 53 }
50 54
55 protected:
56 friend class RenderThread;
51 // Just like in_process_plugins(), but called before RenderProcess is created. 57 // Just like in_process_plugins(), but called before RenderProcess is created.
52 static bool InProcessPlugins(); 58 static bool InProcessPlugins();
53 59
54 private: 60 private:
61 void Init();
62
55 // Look in the shared memory cache for a suitable object to reuse. 63 // Look in the shared memory cache for a suitable object to reuse.
56 // result: (output) the memory found 64 // result: (output) the memory found
57 // size: the resulting memory will be >= this size, in bytes 65 // size: the resulting memory will be >= this size, in bytes
58 // returns: false if a suitable DIB memory could not be found 66 // returns: false if a suitable DIB memory could not be found
59 bool GetTransportDIBFromCache(TransportDIB** result, size_t size); 67 bool GetTransportDIBFromCache(TransportDIB** result, size_t size);
60 68
61 // Maybe put the given shared memory into the shared memory cache. Returns 69 // Maybe put the given shared memory into the shared memory cache. Returns
62 // true if the SharedMemory object was stored in the cache; otherwise, false 70 // true if the SharedMemory object was stored in the cache; otherwise, false
63 // is returned. 71 // is returned.
64 bool PutSharedMemInCache(TransportDIB* memory); 72 bool PutSharedMemInCache(TransportDIB* memory);
(...skipping 20 matching lines...) Expand all
85 // TransportDIB sequence number 93 // TransportDIB sequence number
86 uint32 sequence_number_; 94 uint32 sequence_number_;
87 95
88 bool in_process_plugins_; 96 bool in_process_plugins_;
89 bool initialized_media_library_; 97 bool initialized_media_library_;
90 98
91 DISALLOW_COPY_AND_ASSIGN(RenderProcess); 99 DISALLOW_COPY_AND_ASSIGN(RenderProcess);
92 }; 100 };
93 101
94 #endif // CHROME_RENDERER_RENDER_PROCESS_H__ 102 #endif // CHROME_RENDERER_RENDER_PROCESS_H__
OLDNEW
« no previous file with comments | « chrome/renderer/mock_render_process.h ('k') | chrome/renderer/render_process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698