diff options
author | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-17 05:17:35 +0000 |
---|---|---|
committer | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-17 05:17:35 +0000 |
commit | a7b869bdf6b2c71b30599bbd72f3e1ebdee98fee (patch) | |
tree | 13dd6f9c986da2e17f8e6053f97cf1a265819ce2 /remoting/host | |
parent | 1631f7c651fbc7f4460a852126f545afc5513531 (diff) | |
download | chromium_src-a7b869bdf6b2c71b30599bbd72f3e1ebdee98fee.zip chromium_src-a7b869bdf6b2c71b30599bbd72f3e1ebdee98fee.tar.gz chromium_src-a7b869bdf6b2c71b30599bbd72f3e1ebdee98fee.tar.bz2 |
Inject MessageLoop into Capturer
Simple patch to juse inject the message loop.
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/4971003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66387 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host')
-rw-r--r-- | remoting/host/capturer.cc | 5 | ||||
-rw-r--r-- | remoting/host/capturer.h | 7 | ||||
-rw-r--r-- | remoting/host/capturer_fake.cc | 5 | ||||
-rw-r--r-- | remoting/host/capturer_fake.h | 2 | ||||
-rw-r--r-- | remoting/host/capturer_fake_ascii.cc | 3 | ||||
-rw-r--r-- | remoting/host/capturer_fake_ascii.h | 2 | ||||
-rw-r--r-- | remoting/host/capturer_gdi.cc | 5 | ||||
-rw-r--r-- | remoting/host/capturer_gdi.h | 2 | ||||
-rw-r--r-- | remoting/host/capturer_linux.cc | 5 | ||||
-rw-r--r-- | remoting/host/capturer_linux.h | 2 | ||||
-rw-r--r-- | remoting/host/capturer_mac.cc | 4 | ||||
-rw-r--r-- | remoting/host/capturer_mac.h | 2 | ||||
-rw-r--r-- | remoting/host/capturer_mac_unittest.cc | 3 | ||||
-rw-r--r-- | remoting/host/mock_objects.h | 2 | ||||
-rw-r--r-- | remoting/host/simple_host_process.cc | 11 |
15 files changed, 37 insertions, 23 deletions
diff --git a/remoting/host/capturer.cc b/remoting/host/capturer.cc index b66e577..3e32070 100644 --- a/remoting/host/capturer.cc +++ b/remoting/host/capturer.cc @@ -10,12 +10,13 @@ namespace remoting { -Capturer::Capturer() +Capturer::Capturer(MessageLoop* message_loop) : width_(0), height_(0), pixel_format_(media::VideoFrame::INVALID), bytes_per_row_(0), - current_buffer_(0) { + current_buffer_(0), + message_loop_(message_loop) { } Capturer::~Capturer() { diff --git a/remoting/host/capturer.h b/remoting/host/capturer.h index f9e967a..481b1f3 100644 --- a/remoting/host/capturer.h +++ b/remoting/host/capturer.h @@ -12,6 +12,8 @@ #include "remoting/base/capture_data.h" #include "remoting/base/types.h" +class MessageLoop; + namespace remoting { // A class to perform the task of capturing the image of a window. @@ -42,7 +44,7 @@ class Capturer { // CaptureCompletedCallback is called when the capturer has completed. typedef Callback1<scoped_refptr<CaptureData> >::Type CaptureCompletedCallback; - Capturer(); + explicit Capturer(MessageLoop* message_loop); virtual ~Capturer(); // Called when the screen configuration is changed. @@ -122,6 +124,9 @@ class Capturer { // The current buffer with valid data for reading. int current_buffer_; + // Message loop that operations should run on. + MessageLoop* message_loop_; + private: // Rects that have been manually invalidated (through InvalidateRect). // These will be returned as dirty_rects in the capture data during the next diff --git a/remoting/host/capturer_fake.cc b/remoting/host/capturer_fake.cc index 80f147a..f9684e2 100644 --- a/remoting/host/capturer_fake.cc +++ b/remoting/host/capturer_fake.cc @@ -24,8 +24,9 @@ COMPILE_ASSERT((kBoxWidth % kSpeed == 0) && (kWidth % kSpeed == 0) && static const int kBytesPerPixel = 4; // 32 bit RGB is 4 bytes per pixel. -CapturerFake::CapturerFake() - : box_pos_x_(0), +CapturerFake::CapturerFake(MessageLoop* message_loop) + : Capturer(message_loop), + box_pos_x_(0), box_pos_y_(0), box_speed_x_(kSpeed), box_speed_y_(kSpeed) { diff --git a/remoting/host/capturer_fake.h b/remoting/host/capturer_fake.h index 46e0266..a6279b7 100644 --- a/remoting/host/capturer_fake.h +++ b/remoting/host/capturer_fake.h @@ -16,7 +16,7 @@ namespace remoting { // remoting/host/capturer.h. class CapturerFake : public Capturer { public: - CapturerFake(); + explicit CapturerFake(MessageLoop* message_loop); virtual ~CapturerFake(); virtual void ScreenConfigurationChanged(); diff --git a/remoting/host/capturer_fake_ascii.cc b/remoting/host/capturer_fake_ascii.cc index 2220cba..cbc8471 100644 --- a/remoting/host/capturer_fake_ascii.cc +++ b/remoting/host/capturer_fake_ascii.cc @@ -12,7 +12,8 @@ static const int kWidth = 32; static const int kHeight = 20; static const int kBytesPerPixel = 1; -CapturerFakeAscii::CapturerFakeAscii() { +CapturerFakeAscii::CapturerFakeAscii(MessageLoop* message_loop) + : Capturer(message_loop) { } CapturerFakeAscii::~CapturerFakeAscii() { diff --git a/remoting/host/capturer_fake_ascii.h b/remoting/host/capturer_fake_ascii.h index fc03856..cd02bc4 100644 --- a/remoting/host/capturer_fake_ascii.h +++ b/remoting/host/capturer_fake_ascii.h @@ -17,7 +17,7 @@ namespace remoting { // remoting/host/capturer.h. class CapturerFakeAscii : public Capturer { public: - CapturerFakeAscii(); + explicit CapturerFakeAscii(MessageLoop* message_loop); virtual ~CapturerFakeAscii(); virtual void ScreenConfigurationChanged(); diff --git a/remoting/host/capturer_gdi.cc b/remoting/host/capturer_gdi.cc index 8e1a375..74115bc 100644 --- a/remoting/host/capturer_gdi.cc +++ b/remoting/host/capturer_gdi.cc @@ -14,8 +14,9 @@ static const int kPixelsPerMeter = 3780; // 32 bit RGBA is 4 bytes per pixel. static const int kBytesPerPixel = 4; -CapturerGdi::CapturerGdi() - : desktop_dc_(NULL), +CapturerGdi::CapturerGdi(MessageLoop* message_loop) + : Capturer(message_loop), + desktop_dc_(NULL), memory_dc_(NULL), capture_fullscreen_(true) { memset(target_bitmap_, 0, sizeof(target_bitmap_)); diff --git a/remoting/host/capturer_gdi.h b/remoting/host/capturer_gdi.h index 989f491..72aa261 100644 --- a/remoting/host/capturer_gdi.h +++ b/remoting/host/capturer_gdi.h @@ -20,7 +20,7 @@ class Differ; // remoting/host/capturer.h. class CapturerGdi : public Capturer { public: - CapturerGdi(); + explicit CapturerGdi(MessageLoop* message_loop); virtual ~CapturerGdi(); virtual void ScreenConfigurationChanged(); diff --git a/remoting/host/capturer_linux.cc b/remoting/host/capturer_linux.cc index 2f2f8f0..404d527 100644 --- a/remoting/host/capturer_linux.cc +++ b/remoting/host/capturer_linux.cc @@ -84,8 +84,9 @@ class CapturerLinuxPimpl { bool capture_fullscreen_; }; -CapturerLinux::CapturerLinux() - : pimpl_(new CapturerLinuxPimpl(this)) { +CapturerLinux::CapturerLinux(MessageLoop* message_loop) + : Capturer(message_loop), + pimpl_(new CapturerLinuxPimpl(this)) { // TODO(ajwong): This should be moved into an Init() method on Capturer // itself. Then we can remove the CHECK. CHECK(pimpl_->Init()); diff --git a/remoting/host/capturer_linux.h b/remoting/host/capturer_linux.h index 8d7b32d..6f854fc 100644 --- a/remoting/host/capturer_linux.h +++ b/remoting/host/capturer_linux.h @@ -14,7 +14,7 @@ class CapturerLinuxPimpl; // A class to perform capturing for Linux. class CapturerLinux : public Capturer { public: - CapturerLinux(); + explicit CapturerLinux(MessageLoop* message_loop); virtual ~CapturerLinux(); virtual void ScreenConfigurationChanged(); diff --git a/remoting/host/capturer_mac.cc b/remoting/host/capturer_mac.cc index 4595a95..2ed4c65 100644 --- a/remoting/host/capturer_mac.cc +++ b/remoting/host/capturer_mac.cc @@ -10,7 +10,9 @@ namespace remoting { -CapturerMac::CapturerMac() : cgl_context_(NULL) { +CapturerMac::CapturerMac(MessageLoop* message_loop) + : Capturer(message_loop), + cgl_context_(NULL) { // TODO(dmaclach): move this initialization out into session_manager, // or at least have session_manager call into here to initialize it. CGError err = diff --git a/remoting/host/capturer_mac.h b/remoting/host/capturer_mac.h index b679d8e..96ea159 100644 --- a/remoting/host/capturer_mac.h +++ b/remoting/host/capturer_mac.h @@ -15,7 +15,7 @@ namespace remoting { // A class to perform capturing for mac. class CapturerMac : public Capturer { public: - CapturerMac(); + explicit CapturerMac(MessageLoop* message_loop); virtual ~CapturerMac(); virtual void ScreenConfigurationChanged(); diff --git a/remoting/host/capturer_mac_unittest.cc b/remoting/host/capturer_mac_unittest.cc index 8305b3a..f1f0d6c 100644 --- a/remoting/host/capturer_mac_unittest.cc +++ b/remoting/host/capturer_mac_unittest.cc @@ -17,7 +17,7 @@ namespace remoting { class CapturerMacTest : public testing::Test { protected: virtual void SetUp() { - capturer_.reset(new CapturerMac()); + capturer_.reset(new CapturerMac(NULL)); capturer_->ScreenConfigurationChanged(); rects_.insert(gfx::Rect(0, 0, 10, 10)); } @@ -80,4 +80,3 @@ std::ostream& operator<<(std::ostream& out, } } // namespace gfx - diff --git a/remoting/host/mock_objects.h b/remoting/host/mock_objects.h index 3c51097..d974d1d 100644 --- a/remoting/host/mock_objects.h +++ b/remoting/host/mock_objects.h @@ -12,7 +12,7 @@ namespace remoting { class MockCapturer : public Capturer { public: - MockCapturer() {} + MockCapturer() : Capturer(NULL) {} MOCK_METHOD0(ScreenConfigurationChanged, void()); MOCK_METHOD1(InvalidateRects, void(const InvalidRects& inval_rects)); diff --git a/remoting/host/simple_host_process.cc b/remoting/host/simple_host_process.cc index 0d4b80e..0a6ff42 100644 --- a/remoting/host/simple_host_process.cc +++ b/remoting/host/simple_host_process.cc @@ -80,15 +80,18 @@ int main(int argc, char** argv) { scoped_ptr<remoting::Capturer> capturer; scoped_ptr<remoting::protocol::InputStub> input_stub; #if defined(OS_WIN) - capturer.reset(new remoting::CapturerGdi()); + capturer.reset(new remoting::CapturerGdi( + context.capture_message_loop())); input_stub.reset(new remoting::EventExecutorWin( context.capture_message_loop(), capturer.get())); #elif defined(OS_LINUX) - capturer.reset(new remoting::CapturerLinux()); + capturer.reset(new remoting::CapturerLinux( + context.capture_message_loop())); input_stub.reset(new remoting::EventExecutorLinux( context.capture_message_loop(), capturer.get())); #elif defined(OS_MACOSX) - capturer.reset(new remoting::CapturerMac()); + capturer.reset(new remoting::CapturerMac( + context.capture_message_loop())); input_stub.reset(new remoting::EventExecutorMac( context.capture_message_loop(), capturer.get())); #endif @@ -111,7 +114,7 @@ int main(int argc, char** argv) { if (fake) { // Inject a fake capturer. LOG(INFO) << "Using a fake capturer."; - capturer.reset(new remoting::CapturerFake()); + capturer.reset(new remoting::CapturerFake(context.capture_message_loop())); } base::Thread file_io_thread("FileIO"); |