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

Side by Side Diff: base/message_loop/message_pump_glib.cc

Issue 1255673004: Proof-reading comments in base/message_loop/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: imcoming -> incoming Created 5 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
« no previous file with comments | « base/message_loop/message_loop_unittest.cc ('k') | base/message_loop/message_pump_mac.h » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "base/message_loop/message_pump_glib.h" 5 #include "base/message_loop/message_pump_glib.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <math.h> 8 #include <math.h>
9 9
10 #include <glib.h> 10 #include <glib.h>
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 // system. File descriptors can be attached to the sources. The poll may block 45 // system. File descriptors can be attached to the sources. The poll may block
46 // if none of the Prepare calls returned TRUE. It will block indefinitely, or 46 // if none of the Prepare calls returned TRUE. It will block indefinitely, or
47 // by the minimum time returned by a source in Prepare. 47 // by the minimum time returned by a source in Prepare.
48 // After the poll, GLib calls Check for each source that returned FALSE 48 // After the poll, GLib calls Check for each source that returned FALSE
49 // from Prepare. The return value of Check has the same meaning as for Prepare, 49 // from Prepare. The return value of Check has the same meaning as for Prepare,
50 // making Check a second chance to tell GLib we are ready for Dispatch. 50 // making Check a second chance to tell GLib we are ready for Dispatch.
51 // Finally, GLib calls Dispatch for each source that is ready. If Dispatch 51 // Finally, GLib calls Dispatch for each source that is ready. If Dispatch
52 // returns FALSE, GLib will destroy the source. Dispatch calls may be recursive 52 // returns FALSE, GLib will destroy the source. Dispatch calls may be recursive
53 // (i.e., you can call Run from them), but Prepare and Check cannot. 53 // (i.e., you can call Run from them), but Prepare and Check cannot.
54 // Finalize is called when the source is destroyed. 54 // Finalize is called when the source is destroyed.
55 // NOTE: It is common for subsytems to want to process pending events while 55 // NOTE: It is common for subsystems to want to process pending events while
56 // doing intensive work, for example the flash plugin. They usually use the 56 // doing intensive work, for example the flash plugin. They usually use the
57 // following pattern (recommended by the GTK docs): 57 // following pattern (recommended by the GTK docs):
58 // while (gtk_events_pending()) { 58 // while (gtk_events_pending()) {
59 // gtk_main_iteration(); 59 // gtk_main_iteration();
60 // } 60 // }
61 // 61 //
62 // gtk_events_pending just calls g_main_context_pending, which does the 62 // gtk_events_pending just calls g_main_context_pending, which does the
63 // following: 63 // following:
64 // - Call prepare on all the sources. 64 // - Call prepare on all the sources.
65 // - Do the poll with a timeout of 0 (not blocking). 65 // - Do the poll with a timeout of 0 (not blocking).
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 // variables as we would then need locks all over. This ensures that if 343 // variables as we would then need locks all over. This ensures that if
344 // we are sleeping in a poll that we will wake up. 344 // we are sleeping in a poll that we will wake up.
345 char msg = '!'; 345 char msg = '!';
346 if (HANDLE_EINTR(write(wakeup_pipe_write_, &msg, 1)) != 1) { 346 if (HANDLE_EINTR(write(wakeup_pipe_write_, &msg, 1)) != 1) {
347 NOTREACHED() << "Could not write to the UI message loop wakeup pipe!"; 347 NOTREACHED() << "Could not write to the UI message loop wakeup pipe!";
348 } 348 }
349 } 349 }
350 350
351 void MessagePumpGlib::ScheduleDelayedWork(const TimeTicks& delayed_work_time) { 351 void MessagePumpGlib::ScheduleDelayedWork(const TimeTicks& delayed_work_time) {
352 // We need to wake up the loop in case the poll timeout needs to be 352 // We need to wake up the loop in case the poll timeout needs to be
353 // adjusted. This will cause us to try to do work, but that's ok. 353 // adjusted. This will cause us to try to do work, but that's OK.
354 delayed_work_time_ = delayed_work_time; 354 delayed_work_time_ = delayed_work_time;
355 ScheduleWork(); 355 ScheduleWork();
356 } 356 }
357 357
358 bool MessagePumpGlib::ShouldQuit() const { 358 bool MessagePumpGlib::ShouldQuit() const {
359 CHECK(state_); 359 CHECK(state_);
360 return state_->should_quit; 360 return state_->should_quit;
361 } 361 }
362 362
363 } // namespace base 363 } // namespace base
OLDNEW
« no previous file with comments | « base/message_loop/message_loop_unittest.cc ('k') | base/message_loop/message_pump_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698