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

Side by Side Diff: extensions/browser/api/serial/serial_connection.cc

Issue 780713002: Fix remaining WeakPtrFactory ordering problems (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 6 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 | « extensions/browser/api/serial/serial_connection.h ('k') | media/cast/test/utility/udp_proxy.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/browser/api/serial/serial_connection.h" 5 #include "extensions/browser/api/serial/serial_connection.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 DCHECK_CURRENTLY_ON(BrowserThread::IO); 373 DCHECK_CURRENTLY_ON(BrowserThread::IO);
374 DCHECK(!send_complete_.is_null()); 374 DCHECK(!send_complete_.is_null());
375 SendCompleteCallback callback = send_complete_; 375 SendCompleteCallback callback = send_complete_;
376 send_complete_.Reset(); 376 send_complete_.Reset();
377 send_timeout_task_.reset(); 377 send_timeout_task_.reset();
378 callback.Run(bytes_sent, ConvertSendErrorFromMojo(error)); 378 callback.Run(bytes_sent, ConvertSendErrorFromMojo(error));
379 } 379 }
380 380
381 SerialConnection::TimeoutTask::TimeoutTask(const base::Closure& closure, 381 SerialConnection::TimeoutTask::TimeoutTask(const base::Closure& closure,
382 const base::TimeDelta& delay) 382 const base::TimeDelta& delay)
383 : weak_factory_(this), closure_(closure), delay_(delay) { 383 : closure_(closure), delay_(delay), weak_factory_(this) {
384 base::MessageLoop::current()->PostDelayedTask( 384 base::MessageLoop::current()->PostDelayedTask(
385 FROM_HERE, 385 FROM_HERE,
386 base::Bind(&TimeoutTask::Run, weak_factory_.GetWeakPtr()), 386 base::Bind(&TimeoutTask::Run, weak_factory_.GetWeakPtr()),
387 delay_); 387 delay_);
388 } 388 }
389 389
390 SerialConnection::TimeoutTask::~TimeoutTask() { 390 SerialConnection::TimeoutTask::~TimeoutTask() {
391 } 391 }
392 392
393 void SerialConnection::TimeoutTask::Run() const { 393 void SerialConnection::TimeoutTask::Run() const {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 output->parity_bit = extensions::ConvertParityBitToMojo(input.parity_bit); 429 output->parity_bit = extensions::ConvertParityBitToMojo(input.parity_bit);
430 output->stop_bits = extensions::ConvertStopBitsToMojo(input.stop_bits); 430 output->stop_bits = extensions::ConvertStopBitsToMojo(input.stop_bits);
431 if (input.cts_flow_control.get()) { 431 if (input.cts_flow_control.get()) {
432 output->has_cts_flow_control = true; 432 output->has_cts_flow_control = true;
433 output->cts_flow_control = *input.cts_flow_control; 433 output->cts_flow_control = *input.cts_flow_control;
434 } 434 }
435 return output.Pass(); 435 return output.Pass();
436 } 436 }
437 437
438 } // namespace mojo 438 } // namespace mojo
OLDNEW
« no previous file with comments | « extensions/browser/api/serial/serial_connection.h ('k') | media/cast/test/utility/udp_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698