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

Side by Side Diff: chrome/browser/chromeos/drive/local_file_reader.cc

Issue 686963002: Switching profiler instrumentations from ScopedProfile to ScopedTracker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/chromeos/drive/local_file_reader.h" 5 #include "chrome/browser/chromeos/drive/local_file_reader.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/profiler/scoped_profile.h" 9 #include "base/profiler/scoped_tracker.h"
10 #include "base/sequenced_task_runner.h" 10 #include "base/sequenced_task_runner.h"
11 #include "net/base/completion_callback.h" 11 #include "net/base/completion_callback.h"
12 #include "net/base/io_buffer.h" 12 #include "net/base/io_buffer.h"
13 #include "net/base/net_errors.h" 13 #include "net/base/net_errors.h"
14 14
15 namespace drive { 15 namespace drive {
16 namespace util { 16 namespace util {
17 17
18 LocalFileReader::LocalFileReader( 18 LocalFileReader::LocalFileReader(
19 base::SequencedTaskRunner* sequenced_task_runner) 19 base::SequencedTaskRunner* sequenced_task_runner)
(...skipping 23 matching lines...) Expand all
43 const net::CompletionCallback& callback) { 43 const net::CompletionCallback& callback) {
44 DCHECK(!callback.is_null()); 44 DCHECK(!callback.is_null());
45 DCHECK(file_stream_.IsOpen()); 45 DCHECK(file_stream_.IsOpen());
46 int rv = file_stream_.Read(in_buffer, buffer_length, callback); 46 int rv = file_stream_.Read(in_buffer, buffer_length, callback);
47 DCHECK_EQ(rv, net::ERR_IO_PENDING); 47 DCHECK_EQ(rv, net::ERR_IO_PENDING);
48 } 48 }
49 49
50 void LocalFileReader::DidOpen(const net::CompletionCallback& callback, 50 void LocalFileReader::DidOpen(const net::CompletionCallback& callback,
51 int64 offset, 51 int64 offset,
52 int error) { 52 int error) {
53 // TODO(vadimt): Remove ScopedProfile below once crbug.com/423948 is fixed. 53 // TODO(vadimt): Remove ScopedTracker below once crbug.com/423948 is fixed.
54 tracked_objects::ScopedProfile tracking_profile( 54 tracked_objects::ScopedTracker tracking_profile(
55 FROM_HERE_WITH_EXPLICIT_FUNCTION("423948 LocalFileReader::DidOpen")); 55 FROM_HERE_WITH_EXPLICIT_FUNCTION("423948 LocalFileReader::DidOpen"));
56 56
57 if (error != net::OK) 57 if (error != net::OK)
58 return callback.Run(error); 58 return callback.Run(error);
59 59
60 int rv = file_stream_.Seek(base::File::FROM_BEGIN, offset, 60 int rv = file_stream_.Seek(base::File::FROM_BEGIN, offset,
61 Bind(&LocalFileReader::DidSeek, 61 Bind(&LocalFileReader::DidSeek,
62 weak_ptr_factory_.GetWeakPtr(), 62 weak_ptr_factory_.GetWeakPtr(),
63 callback, offset)); 63 callback, offset));
64 DCHECK_EQ(rv, net::ERR_IO_PENDING); 64 DCHECK_EQ(rv, net::ERR_IO_PENDING);
65 } 65 }
66 66
67 void LocalFileReader::DidSeek(const net::CompletionCallback& callback, 67 void LocalFileReader::DidSeek(const net::CompletionCallback& callback,
68 int64 offset, 68 int64 offset,
69 int64 error) { 69 int64 error) {
70 callback.Run(error == offset ? net::OK : net::ERR_FAILED); 70 callback.Run(error == offset ? net::OK : net::ERR_FAILED);
71 } 71 }
72 72
73 } // namespace util 73 } // namespace util
74 } // namespace drive 74 } // namespace drive
OLDNEW
« no previous file with comments | « base/synchronization/waitable_event_watcher_win.cc ('k') | chrome/browser/extensions/chrome_url_request_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698