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

Side by Side Diff: content/browser/byte_stream.cc

Issue 2523393002: Make comments in byte_stream.cc gender neutral. (Closed)
Patch Set: Re adds context for weak pointers Created 4 years 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 | « no previous file | no next file » | 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 "content/browser/byte_stream.h" 5 #include "content/browser/byte_stream.h"
6 6
7 #include <deque> 7 #include <deque>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/location.h" 12 #include "base/location.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/sequenced_task_runner.h" 15 #include "base/sequenced_task_runner.h"
16 16
17 namespace content { 17 namespace content {
18 namespace { 18 namespace {
19 19
20 typedef std::deque<std::pair<scoped_refptr<net::IOBuffer>, size_t> > 20 typedef std::deque<std::pair<scoped_refptr<net::IOBuffer>, size_t> >
21 ContentVector; 21 ContentVector;
22 22
23 class ByteStreamReaderImpl; 23 class ByteStreamReaderImpl;
24 24
25 // A poor man's weak pointer; a RefCountedThreadSafe boolean that can be 25 // A makeshift weak pointer; a RefCountedThreadSafe boolean that can be cleared
26 // cleared in an object destructor and accessed to check for object 26 // in an object destructor and accessed to check for object existence. We can't
27 // existence. We can't use weak pointers because they're tightly tied to 27 // use weak pointers because they're tightly tied to threads rather than task
28 // threads rather than task runners. 28 // runners.
29 // TODO(rdsmith): A better solution would be extending weak pointers 29 // TODO(rdsmith): A better solution would be extending weak pointers to support
Matt Giuca 2016/11/28 00:10:41 nit: Wrap "to support" onto the next line (no need
meredithl 2016/11/28 00:35:49 Acknowledged.
meredithl 2016/11/28 00:48:08 Done.
30 // to support SequencedTaskRunners. 30 // SequencedTaskRunners.
31 struct LifetimeFlag : public base::RefCountedThreadSafe<LifetimeFlag> { 31 struct LifetimeFlag : public base::RefCountedThreadSafe<LifetimeFlag> {
32 public: 32 public:
33 LifetimeFlag() : is_alive(true) { } 33 LifetimeFlag() : is_alive(true) {}
34 bool is_alive; 34 bool is_alive;
35 35
36 protected: 36 protected:
37 friend class base::RefCountedThreadSafe<LifetimeFlag>; 37 friend class base::RefCountedThreadSafe<LifetimeFlag>;
38 virtual ~LifetimeFlag() { } 38 virtual ~LifetimeFlag() { }
39 39
40 private: 40 private:
41 DISALLOW_COPY_AND_ASSIGN(LifetimeFlag); 41 DISALLOW_COPY_AND_ASSIGN(LifetimeFlag);
42 }; 42 };
43 43
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 ByteStreamReaderImpl* out = new ByteStreamReaderImpl( 456 ByteStreamReaderImpl* out = new ByteStreamReaderImpl(
457 output_task_runner, output_flag, buffer_size); 457 output_task_runner, output_flag, buffer_size);
458 458
459 in->SetPeer(out, output_task_runner, output_flag); 459 in->SetPeer(out, output_task_runner, output_flag);
460 out->SetPeer(in, input_task_runner, input_flag); 460 out->SetPeer(in, input_task_runner, input_flag);
461 input->reset(in); 461 input->reset(in);
462 output->reset(out); 462 output->reset(out);
463 } 463 }
464 464
465 } // namespace content 465 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698